I'm using ABI splits in my app
splits {
abi {
enable true
reset()
include 'x86', 'x86_64', 'armeabi', 'armeabi-v7a', 'arm64-v8a', 'mips'
universalApk true
}
}
If i use a x86_64 emulator then switch to device (armeabi-v7a) (and also others), android studio sends app-x86_64-debug.apk to device
09/27 17:17:49: Launching app
$ adb push SampleFolder\app\build\outputs\apk\app-x86_64-debug.apk /data/local/tmp/sample.package
$ adb shell pm install -r "/data/local/tmp/sample.package"
pkg: /data/local/tmp/sample.package
Failure [INSTALL_FAILED_NO_MATCHING_ABIS]
Edit : The way of how i'm getting this issue
Android Studio 2.2.1
After releasing the 2.2.1, i had played a bit split distributions then everything was looking good. Unfortunately same problem happened to me again. To be make sure clearly, i created new android project and imported realm database (has native libraries) and then,
added split section to gradle
splits {
abi {
enable true
reset()
include 'x86', 'x86_64', 'armeabi', 'armeabi-v7a', 'arm64-v8a', 'mips'
}
}
created application class
public class SampleApp extends Application {
@Override
public void onCreate() {
initRealm();
}
private void initRealm(){
Realm.init(getApplicationContext());
RealmConfiguration.Builder builder = new RealmConfiguration.Builder();
builder.deleteRealmIfMigrationNeeded();
RealmConfiguration configuration = builder.build();
Realm.setDefaultConfiguration(configuration);
}
}
selected my device
app worked, so studio sent appropriate apk(app-armeabi-v7a-debug.apk) to device
$ adb push /home/blackkara/projects/Sample/app/build/outputs/apk/app-armeabi-v7a-debug.apk /data/local/tmp/com.blackkara.sample
After all, i changed the code
public class SampleApp extends Application {
@Override
public void onCreate() {
initRealm();
// The added code
Realm realm = Realm.getDefaultInstance();
}
private void initRealm(){
Realm.init(getApplicationContext());
RealmConfiguration.Builder builder = new RealmConfiguration.Builder();
builder.deleteRealmIfMigrationNeeded();
RealmConfiguration configuration = builder.build();
Realm.setDefaultConfiguration(configuration);
}
}
then ran app again, but this time studio sent wrong apk(app-armeabi-debug.apk) to device
$ adb push /home/blackkara/projects/Sample/app/build/outputs/apk/app-armeabi-debug.apk /data/local/tmp/com.blackkara.sample
Change the build variant By default, Android Studio builds the debug version of your app, which is intended for use only during development, when you click Run. To change the build variant Android Studio uses, select Build > Select Build Variant in the menu bar.
To start debugging an APK, click Profile or debug APK from the Android Studio Welcome screen. Or, if you already have a project open, click File > Profile or Debug APK from the menu bar. In the next dialog window, select the APK you want to import into Android Studio and click OK.
According to Issue 215493 a fix has been released in Android Studio 2.2.1.
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