wequick / Small

A small framework to split app into small parts
http://code.wequick.net/Small
Apache License 2.0
5.04k stars 1.11k forks source link

Rxjava2 找不到类 #425

Open kuwork opened 7 years ago

kuwork commented 7 years ago

错误报告

你做了什么?

复杂的东西(MVP+Retrofit2+Rxjava2)出错了,简化分析,rxjava本来在lib.rx内,现在直接在app.mine里面导入,测试Rxjava2 简单的例子。

dependencies {
    compile fileTree(dir: 'libs', include: ['*.jar'])
    androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', {
        exclude group: 'com.android.support', module: 'support-annotations'
    })
    testCompile 'junit:junit:4.12'
    compile rootProject.ext.dependencies.appcompatV7
    compile rootProject.ext.dependencies.supportV4
    compile rootProject.ext.dependencies.design
    compile rootProject.ext.dependencies.recyclerview
    compile rootProject.ext.dependencies.cardview
    compile rootProject.ext.dependencies.ButterKnifeV7
    compile rootProject.ext.dependencies.Fresco
    compile project(':lib.utils')
    compile 'io.reactivex.rxjava2:rxjava:2.0.1'
    compile 'io.reactivex.rxjava2:rxandroid:2.0.1'
}
public class PersonalCenterActivity extends AppCompatActivity {

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_personal_center);
        Observable<Integer> observable = Observable.create(new ObservableOnSubscribe<Integer>() {
            @Override
            public void subscribe(ObservableEmitter<Integer> emitter) throws Exception {
                LogUtils.d("Observable thread is : " + Thread.currentThread().getName());
                LogUtils.d( "emit 1");
                emitter.onNext(1);
            }
        });

        Consumer<Integer> consumer = new Consumer<Integer>() {
            @Override
            public void accept(Integer integer) throws Exception {
                LogUtils.d("Observer thread is :" + Thread.currentThread().getName());
                LogUtils.d("onNext: " + integer);
            }
        };

        observable.subscribeOn(Schedulers.newThread())
                .observeOn(AndroidSchedulers.mainThread())
                .subscribe(consumer);
    }
}

你期望的结果是什么?

正常运行

实际结果是什么?

闪退,提示找不到类ObservableOnSubscribe,但是直接运行app.mine 就正常

Small环境

Compile-time

  gradle-small plugin : 1.1.0-beta4 (project)
            small aar : 1.1.0-alpha1 (project)
          gradle core : 2.14.1
       android plugin : 2.2.3
       OS : Mac OS X 10.12 (x86_64)

Runtime

  Device : samsung A5009 
     SDK : Android 4.2.2
     ABI : armeabi
galenlin commented 7 years ago

lib.rx插件里有那个类吗,bundle.json配置了lib.rx没有