I am using android studio 2.0 and in last time I upgrade jdk 7 to jdk 8 and I'm making some changes to file gradle but now I am getting this error
E/InstantRun: Could not find slices in APK; aborting.
I/dalvikvm: Could not find method android.content.Context.getSystemService, referenced from method com.mstr.malik.elbalaapps.ControlPanel.access$super
W/dalvikvm: VFY: unable to resolve virtual method 435: Landroid/content/Context;.getSystemService (Ljava/lang/Class;)Ljava/lang/Object;
D/dalvikvm: VFY: replacing opcode 0x6f at 0x004b
I/dalvikvm: Could not find method android.app.Activity.stopLockTask, referenced from method com.mstr.malik.elbalaapps.ControlPanel.access$super
W/dalvikvm: VFY: unable to resolve virtual method 231: Landroid/app/Activity;.stopLockTask ()V
D/dalvikvm: VFY: replacing opcode 0x6f at 0x00b9
E/dalvikvm: Could not find class 'android.os.PersistableBundle', referenced from method com.mstr.malik.elbalaapps.ControlPanel.access$super
W/dalvikvm: VFY: unable to resolve check-cast 224 (Landroid/os/PersistableBundle;) in Lcom/mstr/malik/elbalaapps/ControlPanel;
D/dalvikvm: VFY: replacing opcode 0x1f at 0x00f1
I/dalvikvm: Could not find method android.content.Context.getColorStateList, referenced from method com.mstr.malik.elbalaapps.ControlPanel.access$super
W/dalvikvm: VFY: unable to resolve virtual method 417: Landroid/content/Context;.getColorStateList (I)Landroid/content/res/ColorStateList;
D/dalvikvm: VFY: replacing opcode 0x6f at 0x0101
I/dalvikvm: Could not find method android.app.Activity.onVisibleBehindCanceled, referenced from method com.mstr.malik.elbalaapps.ControlPanel.access$super
W/dalvikvm: VFY: unable to resolve virtual method 154: Landroid/app/Activity;.onVisibleBehindCanceled ()V
D/dalvikvm: VFY: replacing opcode 0x6f at 0x0111
I/dalvikvm: Could not find method android.app.Activity.onWindowStartingActionMode, referenced from method com.mstr.malik.elbalaapps.ControlPanel.access$super
W/dalvikvm: VFY: unable to resolve virtual method 158: Landroid/app/Activity;.onWindowStartingActionMode (Landroid/view/ActionMode$Callback;I)Landroid/view/ActionMode;
D/dalvikvm: VFY: replacing opcode 0x6f at 0x0137
E/dalvikvm: Could not find class 'android.os.PersistableBundle', referenced from method com.mstr.malik.elbalaapps.ControlPanel.access$super
W/dalvikvm: VFY: unable to resolve check-cast 224 (Landroid/os/PersistableBundle;) in Lcom/mstr/malik/elbalaapps/ControlPanel;
D/dalvikvm: VFY: replacing opcode 0x1f at 0x019a
An this is gradle file
apply plugin: 'com.android.application'
android {
compileSdkVersion 23
buildToolsVersion "24.0.0 rc3"
defaultConfig {
applicationId "com.mstr.malik.elbalaapps"
minSdkVersion 18
targetSdkVersion 23
versionCode 1
versionName "1.0"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
testCompile 'junit:junit:4.12'
compile 'com.android.support:appcompat-v7:23.3.0'
}
How can I handle the error, I have tried to chanfe version of compile compile 'com.android.support:appcompat-v7:23.3.0' to compile 'com.android.support:appcompat-v7:23.0.0' It also crash, How can I do it? thanks in advance
If you check in runtime the Android version you can safely ignore this warnings. It just means that you have a reference to a method which is not available on that platform where you code currently runs on. You just need to make sure that you don't use newer APIs on older platforms. Normally lint will warn you if you do something wrong in release builds. As long you keep that in mind you don't need to worry about it.
Just as an example for such an runtime switch:
if(Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
// You can use here an API which was added in Lollipop.
}
this is normal according to google Android engineers.
Refer to https://code.google.com/p/android/issues/detail?id=198567
This happens when you compile against a higher api level than the deployed device api level. The logs are indicating that, some of the methods are not available and the virtual machine is going to replace them with the alternative implementation.
Br, Nick
I have the same warnings and then fatal NoClassDefFoundError. The issue can go from dex generated files in multi-dex mode of android-plugin. All classes that couldn't be found were in one package. The package was split between 2 dex-files. A solution is generating MainDexList file where I included only unresolved classes which were joined to one dex-file. For more details see also here.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With