Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

java.lang.internalError with retrofit and proguard. #28

Closed
PrashamTrivedi opened this issue Sep 3, 2015 · 1 comment
Closed

java.lang.internalError with retrofit and proguard. #28

PrashamTrivedi opened this issue Sep 3, 2015 · 1 comment

Comments

@PrashamTrivedi
Copy link

Hi.
Here is my environment

  1. Extended RxAppComatActivity
  2. Created two methods for composing
 public <T> Transformer<T, T> applyToMainThread() {
        return new Transformer() {
            public Observable<T> call(Observable<T> observable) {
                return observable.observeOn(AndroidSchedulers.mainThread());
            }
        };
    }

    public <T> Transformer<T, T> bindRxActivity(ActivityLifecycleProvider provider) {
        return provider.bindToLifecycle();
    }
  1. Calling a method in onCreate which creates an observable from Retrofit
  2. Calling applyToMainThread followed by bindRxActivity, in two chain calls of compose method.
  3. I have applied proguard on release build where I am discovering this crash
  java.lang.InternalError:22:12.233  13773-13809/? W/System.errjava.lang.InternalError
    at rx.internal.util.unsafe.UnsafeAccess.addressOf(SourceFile:103)
    at rx.internal.util.unsafe.MpmcArrayQueueProducerField.<clinit>(SourceFile:31)
    at rx.internal.util.ObjectPool.initialize(SourceFile:125)
    at rx.internal.util.ObjectPool.<init>(SourceFile:55)
    at rx.internal.util.ObjectPool.<init>(SourceFile:37)
    at rx.internal.util.RxRingBuffer$1.<init>(SourceFile:279)
    at rx.internal.util.RxRingBuffer.<clinit>(SourceFile:279)
    at rx.internal.operators.OnSubscribeCombineLatest.<init>(SourceFile:52)
    at rx.Observable.combineLatest(SourceFile:789)
    at rx.Observable.combineLatest(SourceFile:520)
    at com.trello.rxlifecycle.RxLifecycle$2.call(SourceFile:152)
    at com.trello.rxlifecycle.RxLifecycle$2.call(SourceFile:148)
    at rx.Observable.compose(SourceFile:204)
    at com.restaurant.zoomi.SplashScreen.getApplicationObject(SourceFile:131)
    at com.restaurant.zoomi.SplashScreen.onCreate(SourceFile:118)
    at android.app.Activity.performCreate(Activity.java:5990)
    at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1106)
    at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2278)
    at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2387)
    at android.app.ActivityThread.access$800(ActivityThread.java:151)
    at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1303)
    at android.os.Handler.dispatchMessage(Handler.java:102)
    at android.os.Looper.loop(Looper.java:135)
    at android.app.ActivityThread.main(ActivityThread.java:5254)
    at java.lang.reflect.Method.invoke(Native Method)
    at java.lang.reflect.Method.invoke(Method.java:372)
    at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:903)
    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:698)
    at java.lang.Class.getDeclaredField(Class.java:890)
    at rx.internal.util.unsafe.UnsafeAccess.addressOf(SourceFile:100)

SourceFile:152 points to following code.

private static <T, R> Transformer<T, T> bind(Observable<R> lifecycle, final Func1<R, R> correspondingEvents) {
        if(lifecycle == null) {
            throw new IllegalArgumentException("Lifecycle must be given");
        } else {
            final Observable sharedLifecycle = lifecycle.share();
            return new Transformer() {
                public Observable<T> call(Observable<T> source) {
                    return source.takeUntil(Observable.combineLatest(sharedLifecycle.take(1).map(correspondingEvents), sharedLifecycle.skip(1), new Func2() {
                        public Boolean call(R bindUntilEvent, R lifecycleEvent) {
                            return Boolean.valueOf(lifecycleEvent == bindUntilEvent);
                        }
                    }).takeFirst(new Func1() {
                        public Boolean call(Boolean shouldComplete) {
                            return shouldComplete;
                        }
                    }));
                }
            };
        }
    }

This code runs fine in debug build without obfuscation.
Is there anything done wrong w.r.t. proguard?

@dlew
Copy link
Contributor

dlew commented Sep 3, 2015

This is not an issue with RxLifecycle, but with proguard + RxJava: ReactiveX/RxJava#3097

@dlew dlew closed this as completed Sep 3, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants