Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

App can't run on devices below Android 7.1 after migrating to Android Studio 3

After upgrading to Android Studio 3, app can't be installed on Android 5 and 7 devices that we tried on - if I send myself the APK it says "App not installed" and if I try to build from AS it restarts the phone with a corrupt memory block exception in the logs.

App can be installed on emulators running those android versions, though.

App can be installed on Android 7.1.1 and 8 that we tested on.

Tried with Java 8 compatibility both enabled and disabled - same result.

Minify is enabled. Enabled it additionally in 2 modules as well.

compileSdkVersion 26
buildToolsVersion '26.0.2'

defaultConfig {
    minSdkVersion 21
    targetSdkVersion 26
    useLibrary 'org.apache.http.legacy'
    applicationId 'com.myapp.android'
    versionName "6.0.0.2"
    versionCode 6002
    multiDexEnabled true
    testInstrumentationRunner "com.android.test.runner.MultiDexTestRunner"
}

Here's the error message

ime: Calling main entry com.android.commands.am.Am
11-01 11:03:20.807 26024-26589/system_process I/ActivityManager: START u0 {act=android.intent.action.MAIN cat=[android.intent.category.LAUNCHER] flg=0x10000000 cmp=com.myapp.android/.app.MainActivity_} from uid 2000 on display 0
11-01 11:03:20.811 26024-26589/system_process A/libc: invalid address or address of corrupt block 0x39 passed to dlfree
11-01 11:03:20.811 26024-26589/system_process A/libc: Fatal signal 11 (SIGSEGV), code 1, fault addr 0xdeadbaad in tid 26589 (Binder_8)
11-01 11:03:20.913 14726-14726/? I/DEBUG: *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** ***
11-01 11:03:20.913 14726-14726/? I/DEBUG: Build fingerprint: 'motorola/condor_retgb/condor_umts:4.4.4/KXC21.5-40/46:user/release-keys'
11-01 11:03:20.913 14726-14726/? I/DEBUG: Revision: '33456'
11-01 11:03:20.913 14726-14726/? I/DEBUG: ABI: 'arm'
11-01 11:03:20.914 14726-14726/? I/DEBUG: pid: 26024, tid: 26589, name: Binder_8  >>> system_server <<<
11-01 11:03:20.914 14726-14726/? I/DEBUG: signal 11 (SIGSEGV), code 1 (SEGV_MAPERR), fault addr 0xdeadbaad
11-01 11:03:20.945 14726-14726/? I/DEBUG: Abort message: 'invalid address or address of corrupt block 0x39 passed to dlfree'
11-01 11:03:20.945 14726-14726/? I/DEBUG:     r0 00000000  r1 b6ee4dec  r2 deadbaad  r3 00000000
11-01 11:03:20.945 14726-14726/? I/DEBUG:     r4 00000039  r5 b6ee60d4  r6 98697000  r7 00000041
11-01 11:03:20.945 14726-14726/? I/DEBUG:     r8 9e566bfc  r9 9e566cbc  sl b6bd85d2  fp b6bd85db
11-01 11:03:20.945 14726-14726/? I/DEBUG:     ip 80808000  sp 9e566ba8  lr b6eb5e2f  pc b6eb5e30  cpsr 60010030
11-01 11:03:20.945 14726-14726/? I/DEBUG: backtrace:
10-31 22:41:28.134 254-254/? I/DEBUG:     #00 pc 00028e30  

/system/lib/libc.so (dlfree+1239)
10-31 22:41:28.134 254-254/? I/DEBUG:     #01 pc 0000f0c3  /system/lib/libc.so (free+10)
10-31 22:41:28.134 254-254/? I/DEBUG:     #02 pc 00012dd9  /system/lib/libandroidfw.so (android::ResStringPool::uninit()+38)
10-31 22:41:28.134 254-254/? I/DEBUG:     #03 pc 00013b33  /system/lib/libandroidfw.so (android::ResXMLTree::uninit()+12)
10-31 22:41:28.134 254-254/? I/DEBUG:     #04 pc 00013b51  /system/lib/libandroidfw.so (android::ResXMLTree::~ResXMLTree()+4)
10-31 22:41:28.134 254-254/? I/DEBUG:     #05 pc 00010843  /system/lib/libandroidfw.so (android::AssetManager::getPkgName(char const*)+258)
10-31 22:41:28.134 254-254/? I/DEBUG:     #06 pc 000108a5  /system/lib/libandroidfw.so (android::AssetManager::getBasePackageName(unsigned int)+68)
10-31 22:41:28.134 254-254/? I/DEBUG:     #07 pc 00080de7  /system/lib/libandroid_runtime.so
10-31 22:41:28.134 254-254/? I/DEBUG:     #08 pc 00270eef  /data/dalvik-cache/arm/system@[email protected]

EDIT: I found something here that might be related https://issuetracker.google.com/issues/64434571

like image 984
K.R. Avatar asked Nov 01 '17 08:11

K.R.


People also ask

How do I make an app compatible with Android 10?

Ensure basic compatibility. As soon as possible, make sure your existing published app is ready for users who are updating or purchasing new devices running Android 10. Test your app to verify that it's fully functional, then publish the compatible version of the app to users. Build with Android 10 features and APIs.

Why is my Android Studio app not installing?

The Android app not installed error can be combated after resetting app permissions. Go to Settings > Apps > Reset App Preferences/Reset Application Permissions. After this, third-party software can be installed on your device.


1 Answers

So turns out this is a bug in CyanogenMOD/LineageOS and possibly other custom ROMs who modify things they aren't supposed to modify.

The workaround is to turn off AAPT2 (but I don't know what the cons of that are)

Google have fixed this in build tools 27 but I don't know if we can use that yet?

https://issuetracker.google.com/issues/64434571

EDIT: If you are still unable to install your app on some devices that you don't directly build on, first File -> Invalidate caches / Restart, then Build -> Clean, and most importantly - don't use the APK file that you get from clicking RUN, use the one you can create by Build -> Build APK(s)

like image 124
K.R. Avatar answered Nov 15 '22 05:11

K.R.