Beta by Crashlytics - Package appears to be corrupted
Asked Answered
T

3

7

I recently developed an app for a client and now have to share it on Crashlytics for a Beta. I did this many times in the past but with this app, there's a problem.

When I upload my app on Crashlytics Studio's plugin, there's no error. The email is correctly delivered to testers.

But at the end of the installation, it says "The package appears to be corrupted".

This is the first time I see this and I don't know what to do.

I try with all this type of APK: - debug (unsigned) - release (unsigned) - release (signed)

None of it works.

Here's my build.gradle :

    buildscript {
    repositories {
        maven { url 'https://maven.fabric.io/public' }
    }

    dependencies {
        // These docs use an open ended version so that our plugin
        // can be updated quickly in response to Android tooling updates

        // We recommend changing it to the latest version from our changelog:
        // https://docs.fabric.io/android/changelog.html#fabric-gradle-plugin
        classpath 'io.fabric.tools:gradle:1.24.1'
    }
}

apply plugin: 'com.android.application'
apply plugin: 'kotlin-android'
apply plugin: 'kotlin-android-extensions'
apply plugin: 'io.fabric'

repositories {
    maven { url 'https://maven.fabric.io/public' }
    maven { url "https://jitpack.io" }
}

android {

    compileSdkVersion 26
    buildToolsVersion "26.0.1"

    defaultConfig {
        applicationId "com.xxxxxxx"
        minSdkVersion 15
        targetSdkVersion 26
        versionCode 3
        versionName "0.1.3"
        testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
        vectorDrawables.useSupportLibrary = true
        renderscriptSupportModeEnabled = true
    }
    buildTypes {
        release {
            minifyEnabled = true
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
            signingConfig signingConfigs.release
        }
    }
}

dependencies {
    implementation fileTree(dir: 'libs', include: ['*.jar'])

    /**
     * SUPPORT LIBS
     */
    implementation 'com.android.support:appcompat-v7:26.0.2'
    implementation 'com.android.support:recyclerview-v7:26.0.2'
    implementation 'com.android.support:design:26.0.2'
    implementation 'com.android.support.constraint:constraint-layout:1.0.2'
    implementation 'com.android.support:support-vector-drawable:26.0.2'

    /**
     * KOTLIN
     */
    implementation "org.jetbrains.kotlin:kotlin-stdlib-jre7:$kotlin_version"

    /**
     * UNIT TESTS
     */
    testImplementation 'junit:junit:4.12'
    androidTestImplementation('com.android.support.test.espresso:espresso-core:3.0.1', {
        exclude group: 'com.android.support', module: 'support-annotations'
    })

    /**
     * HTTP
     */
    implementation 'com.squareup.retrofit2:retrofit:2.3.0'
    implementation "com.squareup.retrofit2:converter-gson:2.3.0"
    implementation "com.squareup.retrofit2:adapter-rxjava:2.3.0"
    implementation 'com.squareup.okhttp3:logging-interceptor:3.8.0'

    /**
     * INJECTION LIB
     */
    implementation 'com.jakewharton:butterknife:8.8.1'
    annotationProcessor 'com.jakewharton:butterknife-compiler:8.8.1'

    /**
     * COMPONENT LIBS
     */
    implementation('com.mikepenz:fastadapter:2.6.3@aar') {
        transitive = true
    }
    implementation 'com.mikepenz:fastadapter-commons:2.6.3@aar'
    implementation 'com.mikepenz:fastadapter-extensions:2.6.3@aar'

    /**
     * IMAGE LOADING/CACHING/EDITING LIBS
     */
    implementation 'com.github.bumptech.glide:glide:4.1.1'
    annotationProcessor 'com.github.bumptech.glide:compiler:4.1.1'
    implementation 'com.makeramen:roundedimageview:2.3.0'

    /**
     * PLAYERS VIDEO/MUSIC
     */
    implementation 'com.google.android.exoplayer:exoplayer:r2.0.0'
    implementation 'com.dailymotion.dailymotion-sdk-android:sdk:0.1.12'

    /**
     * EVENTBUS
     */
    implementation 'org.greenrobot:eventbus:3.0.0'

    /**
     * Overscroll
     */
    implementation 'com.scwang.smartrefresh:SmartRefreshLayout:1.0.3'
    implementation 'com.scwang.smartrefresh:SmartRefreshHeader:1.0.3'

    /**
     * FABRIC/CRASHLYTICS
     */
    implementation('com.crashlytics.sdk.android:crashlytics:2.6.8@aar') {
        transitive = true
    }
}

How can I solve it?

Tetrabasic answered 15/9, 2017 at 11:58 Comment(5)
Have you tried adding android:extractNativeLibs="false" to your Manifest?Branle
Thank you for your answer, I just tried and still got the same error ...Tetrabasic
Mike from Fabric here. What's the Logcat output you see when trying to install the app?Vookles
Hello Mike, thx for your answer. I've just rebuild my projet on Studio 2 instead of Studio 3 (beta 5) and it works. I replace all "implementation" by "compile" in the gradle file and remove rounded ic_launcher. I think the problem wasn't on Crashlytics but i'm not sure right nowTetrabasic
This helped me https://mcmap.net/q/259496/-getting-error-quot-the-package-appears-to-be-corrupt-quot-while-installing-apk-fileBogusz
U
5

Since Android Studio 3.0, I have the exact same problem if I try to upload an apk via the user interface.

For now, you will have to use the command line in order to upload an apk, as the documentation says.

./gradlew assembleDebug crashlyticsUploadDistributionDebug

I hope this will help !

Unemployment answered 1/11, 2017 at 20:1 Comment(1)
I can confirm this is the correct answer. I'm not sure why building the APK from the Build menu wasn't allowing apps to be installed via beta by crashlytics but uploading via gradle worked a treat!Geese
M
2

Use Build APK(s) option instead of Run! I also recommend to clean the project first.

enter image description here

Monopode answered 6/4, 2018 at 14:0 Comment(0)
A
1

i answered to a similar question here

For me the solution was to downgrade gradle from version 3.0.0 (introduced with Android Studio 3) to 2.3.3 (previous version). I made this by replacing this line in the project .gradle file:

    buildscript {
    repositories {
        ...
    }
    dependencies {
        classpath 'com.android.tools.build:gradle:3.0.0'
        ...
    }
}

With:

    buildscript {
    repositories {
        ...
    }
    dependencies {
        classpath 'com.android.tools.build:gradle:2.3.0'
        ...
    }
}

After a clen and build i was able to upload my app to Beta and install it with no problem.

Aestival answered 9/11, 2017 at 16:48 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.