question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

ANR on Android 4.x-5.x onCreate

See original GitHub issue

AppIntro Version: 4.2.0

compileSdkVersion 25
    buildToolsVersion "25.0.3"
    defaultConfig {
        applicationId = "com.myapp"
        minSdkVersion 11
        targetSdkVersion 25
        versionCode 100
        versionName "3.1.8"
    }

buildTypes {
        release {
            minifyEnabled true
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-project.txt'
        }
    }
dependencies {
    compile project(':aFileChooser')
    compile 'com.android.support:appcompat-v7:25.1.0'
    compile 'com.android.support:support-v4:25.1.0'
    compile 'com.android.support:design:25.1.0'
    compile 'de.mindpipe.android:android-logging-log4j:1.0.3'
    compile 'com.github.apl-devs:appintro:v4.2.0'
    compile 'log4j:log4j:1.2.17'
}

Device/Android Version: 5.x

Issue details / Repro steps / Use case background: App is reported crashing on Android 4.x-5.x, really have no clue about that. Tried downgrading Google libs from 25.3.x to 25.01.0 as shown in some SO threads but issue was not solved. I suppose it’s related to Proguard optimization of Appintro lib.

Your Code:

import android.os.Bundle;
import android.support.annotation.Nullable;
import android.support.v4.app.Fragment;

import com.github.paolorotolo.appintro.AppIntro;

public class IntroActivity extends AppIntro {

    @Override
    protected void onCreate(@Nullable Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        addSlide(SampleSlide.newInstance(R.layout.slide1));
        addSlide(SampleSlide.newInstance(R.layout.slide2));
        addSlide(SampleSlide.newInstance(R.layout.slide3));
        addSlide(SampleSlide.newInstance(R.layout.slide4));
        setBarColor(getColor(R.color.colorPrimary));
    }

    @Override
    public void onSkipPressed(Fragment currentFragment) {
        finish();
    }

    @Override
    public void onDonePressed(Fragment currentFragment) {
        finish();
    }

}

Stack trace / LogCat:

java.lang.NoSuchMethodError: 
  at com.nbeghin.lib.myapp.IntroActivity.onCreate(IntroActivity.java:0)
  at android.app.Activity.performCreate(Activity.java:6092)
  at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1112)
  at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2468)
  at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2595)
  at android.app.ActivityThread.access$800(ActivityThread.java:178)
  at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1470)
  at android.os.Handler.dispatchMessage(Handler.java:111)
  at android.os.Looper.loop(Looper.java:194)
  at android.app.ActivityThread.main(ActivityThread.java:5631)
  at java.lang.reflect.Method.invoke(Method.java:0)
  at java.lang.reflect.Method.invoke(Method.java:372)
  at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:959)
  at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:754)

Proguard

-dontwarn org.apache.log4j.**
-keepnames public class com.ianhanniballake.localstorage.LocalStorageProvider
-keepclassmembers public class com.ianhanniballake.localstorage.LocalStorageProvider {
    public static final String AUTHORITY;
}

image 3

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Comments:12 (6 by maintainers)

github_iconTop GitHub Comments

1reaction
nicolabeghincommented, Jun 9, 2017

I’ll surely check that tonight, I have the dump.txt generated by ProGuard and this should shed some light on the whole thing (if AppIntro classes are obfuscated it means ProGuard rules are not taken into considerations, as I see from consumer-proguard-rules.pro https://github.com/apl-devs/AppIntro/blob/master/library/consumer-proguard-rules.pro) -keep class com.github.paolorotolo.** {*;}

0reactions
avluiscommented, Jun 9, 2017

Ah~ I’ve seen this before on prior projects. You definitely want to make use of ContextCompat whenever possible when using the newer tools.

Read more comments on GitHub >

github_iconTop Results From Across the Web

ANR on Android 4.x-5.x onCreate · Issue #446 - GitHub
Issue details / Repro steps / Use case background: App is reported crashing on Android 4.x-5.x, really have no clue about that.
Read more >
ANRs - Android Developers
When the UI thread of an Android app is blocked for too long, an "Application Not Responding" (ANR) error is triggered. If the...
Read more >
How can I save an activity state using the save instance state?
onSaveInstanceState() is called by Android if the Activity is being stopped and may be killed before it is resumed! This means it should...
Read more >
Native Socket.IO and Android
In this tutorial well learn how to create a chat client that communicates with a Socket.IO Node.JS chat server, with our native Android...
Read more >
Custom Tasks - Gradle Recipes for Android [Book] - O'Reilly
The Gradle DSL supports a task block for defining your own custom tasks. The API includes a wide range of existing tasks (like...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found