问题
I have installed android-instant-run introduced in android-studio-2.0
I am getting problem while running my app first time. Its appearing with blank screen for a 5 to 10 seconds then after launching activity.
It takes time to run first time only for every application but why it happens that I don't know.
Logcat : W/System: ClassLoader referenced unknown path: /data/app/com.package.name/lib/arm
回答1:
Hello I am also facing this issue when i update my Android Studio 2.0
This issue is resolved by changing minSDKVersion from 14 to 16 and change the gradle version to 2.4. This will work fine.
回答2:
The question is already answered, but in my case, it is due to the strange issue with Android Studio 2.0 & 2.1. First time of launching application take longer than usual. This issue happens only in debug mode and not effect your released APK. Try creating a release build of your app and check. It should work perfectly.
回答3:
It's because with Instant Run
enabled, Android Studio injecting some dex files
to make Instant Run function run in target device. Because of it, your application will take longer times to run than it normally does.
To check it, look at your Android Studio monitor when it starting to run your application. It will show that some dex files been loading.
The benefit of Instant Run
is when you change your application and run it, sometimes it will immediately run in your device target with short delay compared without Instant Run.
But the caveat is, Instant Run still buggy and it doesn't always work.
回答4:
Go to Gradle scripts -> build.gradle (Project). Inside the dependencies block, replace this line:
classpath 'com.android.tools.build:gradle:2.0.0'
with this one,
classpath 'com.android.tools.build:gradle:1.3.0'
Now, sync your project. After syncing your project, you will get some errors.
Go to gradle-wrapper.properties. Now replace this this line:
distributionUrl=https\://services.gradle.org/distributions/gradle-2.10-all.zip
with this one:
distributionUrl=https\://services.gradle.org/distributions/gradle-2.2-all.zip
Sync your project once or twice and your problem should be solved.
来源:https://stackoverflow.com/questions/36638098/android-instant-run-first-time-takes-too-much-time-to-launch-app-after-installed