Kishanjvaghela/Ask-Permission

Crash: v13 support libraries missing when using `exclude group: 'com.android.support'`

nyanpasu64 opened this issue · 4 comments

https://github.com/Kishanjvaghela/Ask-Permission/blob/master/askpermission/src/main/java/com/kishan/askpermission/ShadowFragment.java#L7

IntelliJ highlights "app" as red.

https://github.com/Kishanjvaghela/Ask-Permission/blob/master/askpermission/src/main/java/com/kishan/askpermission/ShadowFragment.java#L52

When running the app, when I try requesting permissions it crashes with:

java.lang.NoClassDefFoundError: Failed resolution of: Landroid/support/v13/app/ActivityCompat;


My module-level build.gradle contains:

android {
    defaultConfig {
    compileSdkVersion 28
        minSdkVersion 19
        targetSdkVersion 28
...
dependencies {
    implementation('com.kishan.askpermission:askpermission:1.0.3', {
        exclude group: 'com.android.support'
    })
...

I think I know what went wrong. https://github.com/Kishanjvaghela/Ask-Permission#how-to-use tells me to exclude group: 'com.android.support', but this causes the v13 support library to never get downloaded. I'm not sure how to fix the documentation to warn of this issue...


Also it seems that https://developer.android.com/reference/android/support/v13/app/ActivityCompat is deprecated:

This class was deprecated in API level 27.1.0.
Use android.support.v4.app.ActivityCompat.

ioxua commented

This library depends on Android Support AppCompat@24.2.1
I think it can be fixed by bumping to the latest version (27.1.1 as of today)

same problem here as jimbo1qaz has.

the same

https://github.com/Kishanjvaghela/Ask-Permission/blob/master/app/build.gradle

Maybe @Kishanjvaghela should edit the above file to not depend on exact versions, then users could remove exclude group: 'com.android.support' and let Gradle pick any version it wants, without risk of conflicting with the app's support library choices..

I think the easiest workaround is to keep exclude and add implementation 'com.android.support:support-v13:27.1.1' (or similar version) to app/build.gradle. At least that's what I used in https://github.com/jimbo1qaz/0cc-to-nsf-android/commit/d6690b87d9d88f5278f0b7546946a646801a5e63 (which I subsequently removed. I think another library pulled in a version of support-v13).