当我使用帖子时,奥托巴士不起作用

时间:2018-01-29 17:26:36

标签: java android android-studio gradle android-gradle

我改变了gradle 3.0.1的项目,并且在我的渐变配置中更改了一些内容,包括FCM并删除了“apts”。在那之后,巴士不再工作。

我创建了注册表,我创建了我的总线单例,但是@Subscribe函数中的事件我的Bus.post不起作用。

请帮帮我。 我不知道该怎么办?

builder.gradle

buildscript {
    repositories {
        mavenCentral()
        jcenter()
        google()
    }

    dependencies {
        classpath 'com.android.tools.build:gradle:3.0.1'
        classpath 'com.google.gms:google-services:3.1.2' // google-services plugin
    }
}

allprojects {
    repositories {
        maven {
            url "https://maven.google.com" // Google's Maven repository
        }
    }
}

app.gradle

apply plugin: 'com.android.application' apply plugin: 'com.google.gms.google-services' apply plugin: 'io.fabric' apply plugin: 'jacoco' def AAVersion = '4.4.0'


android {
    compileSdkVersion 27
    buildToolsVersion '27.0.2'

    defaultConfig {
        applicationId "br.com.itausolucoes.participante"
        minSdkVersion 14
        targetSdkVersion 21
        versionCode Integer.parseInt(VERSION_CODE)
        versionName VERSION_NAME
        testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
        javaCompileOptions {
            annotationProcessorOptions {
                arguments = ["resourcePackageName": android.defaultConfig.applicationId]
            }
        }

    }
    signingConfigs {
        release {
            def filePrivateProperties = file("signin.properties")
            if (filePrivateProperties.exists()) {
                Properties propsPrivate = new Properties()
                propsPrivate.load(new FileInputStream(filePrivateProperties))

                storeFile file(propsPrivate['KEYSTORE'])
                keyAlias propsPrivate['KEY_ALIAS']
                storePassword propsPrivate['KEYSTORE_PASSWORD']
                keyPassword propsPrivate['KEY_PASSWORD']
            }
            keyAlias 'isp'
            keyPassword 'd7dVSGDWPNmt5zpshReb'
            storeFile file('C:/Users/brq.marcos.souza/workspace/Participante_Droid_Ori/participantemobile-android.git/keys/keystore.jks')
            storePassword 'wnH2cMqQ6r1WCSYr1lVb'
        }
        debug {
            storeFile file('C:/Users/brq.marcos.souza/workspace/Participante_Droid_Ori/participantemobile-android.git/keys/keystore.jks')
            keyAlias 'isp'
            storePassword 'wnH2cMqQ6r1WCSYr1lVb'
            keyPassword 'd7dVSGDWPNmt5zpshReb'
        }
    }

    buildTypes {
        release {
            applicationIdSuffix ".release"
            versionNameSuffix '-release'
            zipAlignEnabled true
            minifyEnabled true
            shrinkResources true
            debuggable false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
            signingConfig signingConfigs.release
        }
        homolog {
            applicationIdSuffix ".homolog"
            versionNameSuffix '-homolog'
            debuggable true
            minifyEnabled true
            shrinkResources false
            signingConfig signingConfigs.debug
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
        debug {
            applicationIdSuffix ".debug"
            versionNameSuffix '-debug'
            debuggable true
            minifyEnabled true
            shrinkResources false
            signingConfig signingConfigs.debug
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
    }

    flavorDimensions "app"
    productFlavors {
        abril {
            dimension "app"
            applicationId 'br.com.itausolucoes.participante.abril'
        }
        eletros {
            dimension "app"
            applicationId 'br.com.itausolucoes.participante.eletros'
        }
        itaubanco {
            dimension "app"
            applicationId 'br.com.itausolucoes.participante.itaubanco'
        }
    }

    packagingOptions {
        exclude 'META-INF/LICENSE.txt'
        exclude 'META-INF/NOTICE.txt'
        exclude 'LICENSE.txt'
    }

    lintOptions {
        quiet true
        abortOnError false
        ignore 'InvalidPackage'
    }

}

android.applicationVariants.all { variant ->
    variant.variantData.variantConfiguration.javaCompileOptions.annotationProcessorOptions.arguments
=
            ['androidManifestFile': variant.outputs[0]?.processResources?.manifestFile,
             'resourcePackageName': android.defaultConfig.applicationId] } 

我的服务:

   @Override
    public void recoverEntityData() {
        BusProvider.getRepositoryBusInstance().register(this);
        splashRepositoryHttp.recoverEntityData();
    }

我的Http有“post()”:

@EBean public class SplashRepositoryHttpImpl implements SplashRepositoryHttp {
    @Bean
    WebServiceManagerImpl webServiceManagerImpl;

    @Override
    @Background
    public void recoverEntityData() {
        webServiceManagerImpl.getInstanceWebServiceAPI().entityData(new RestCallback<ResponseEntityVO>(
                new SplashGenericError(), new SplashErrorsList(), new SplashConnectionError(),
                new SplashUnauthorizedError()
        ) {
            @Override
            public void success(ResponseEntityVO responseEntityVO, Response response) {
                BusProvider.getRepositoryBusInstance().post(responseEntityVO);
            }

这是我在服务中获得活动的地方:

@Subscribe
public void onStoredEntityData(@NonNull ResponseEntityVO responseEntityVO) {
    BusProvider.getRepositoryBusInstance().unregister(this);
    entityRepositoryDisk.saveEntityData(responseEntityVO.getEntityVO());
    BusProvider.getServiceBusInstance().post(responseEntityVO.getEntityVO());
}

我的单身人士:

@EBean(scope = EBean.Scope.Singleton)
public class BusProvider {
    private static Bus UI_BUS = new Bus(ThreadEnforcer.ANY);
    private static Bus SERVICE_BUS = new Bus(ThreadEnforcer.ANY);
    private static Bus REPOSITORY_BUS = new Bus(ThreadEnforcer.ANY);
    private static Bus ERROR_BUS = new Bus(ThreadEnforcer.ANY);

    public static Bus getUiInstance() {
        return UI_BUS;
    }

    public static Bus getErrorBusInstance() {
        return ERROR_BUS;
    }

    public static Bus getServiceBusInstance() {
        return SERVICE_BUS;
    }

    public static Bus getRepositoryBusInstance() {
        return REPOSITORY_BUS;
    }

    public static void setUiBus(Bus bus) {
        UI_BUS = bus;
    }

    public static void setRepositoryBus(Bus bus) {
        REPOSITORY_BUS = bus;
    }

    public static void setServiceBus(Bus bus) {
        SERVICE_BUS = bus;
    }

    public static void setErrorBus(Bus bus) {
        ERROR_BUS = bus;
    }
}

0 个答案:

没有答案