Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Android App Bundle from React Native: You uploaded an APK or Android App Bundle with invalid or missing signing information for some of its files

I'm trying to publish an app for the first time to the Google Play Store. I've opted in to Google Play Signing. I know for a fact that I'm signing the Android App Bundle with the right key since, when I'm uploading using another key, the Console will tell me to upload using the other key with the specific SHA1 identifier. However, when I do upload with the correct key, I get this error:

You uploaded an APK or Android App Bundle with invalid or missing signing information for some of its files.

I'm building the app using Android Studio like so: Build > Generate Signed Bundle / APK > Android App Bundle > Choosing my keystore and entering the password > release > Finish

The app is a React Native app built with detached Expo / ExpoKit. Uploading to the Apple App Store works just fine, I only have problems with the Play Store. What am I missing?

Update 1: I now completely deleted the app from Google Play and created a new one. Did not opt in for Google Play Signing this time and uploaded a signed APK. Still the same error.

Update 2: Tried with a completely new keystore and key. Still the same.

Here's an overview of the project setup if this would somehow be important: Project Overview

And here's the android/app/build.gradle:

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

  dependencies {
    classpath 'io.fabric.tools:gradle:1.26.1'
  }
}
apply plugin: 'com.android.application'
apply plugin: 'io.fabric'
apply plugin: 'devicefarm'

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

def safeExtGet(prop, fallback) {
  rootProject.ext.has(prop) ? rootProject.ext.get(prop) : fallback
}

android {
  compileSdkVersion safeExtGet("compileSdkVersion", 28)

  compileOptions {
    sourceCompatibility JavaVersion.VERSION_1_8
    targetCompatibility JavaVersion.VERSION_1_8
  }

  defaultConfig {
    applicationId 'de.***.android'
    minSdkVersion safeExtGet("minSdkVersion", 21)
    targetSdkVersion safeExtGet("targetSdkVersion", 28)
    versionCode 1
    versionName '1.0.2'
    ndk {
      abiFilters 'armeabi-v7a', 'x86'
    }
    multiDexEnabled true
    testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
    // Deprecated. Used by net.openid:appauth
    manifestPlaceholders = [
        'appAuthRedirectScheme': 'host.exp.exponent'
    ]
  }
  dexOptions {
    javaMaxHeapSize System.getenv("DISABLE_DEX_MAX_HEAP") ? null : "8g"
  }

  signingConfigs {
    debug {
      storeFile file('../debug.keystore')
    }
    release {
      storeFile file(System.getenv("ANDROID_KEYSTORE_PATH") ?: "release-key.jks")
      storePassword System.getenv("ANDROID_KEYSTORE_PASSWORD")
      keyAlias System.getenv("ANDROID_KEY_ALIAS")
      keyPassword System.getenv("ANDROID_KEY_PASSWORD")
    }
  }
  buildTypes {
    debug {
      debuggable true
      ext.enableCrashlytics = false
    }
    release {
      minifyEnabled true
      proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
      signingConfig signingConfigs.release
    }
  }
  lintOptions {
    abortOnError false
  }
  packagingOptions {
    pickFirst "**"
  }
}

devicefarm {
  projectName System.getenv("DEVICEFARM_PROJECT_NAME")
  devicePool System.getenv("DEVICEFARM_DEVICE_POOL")
  executionTimeoutMinutes 40
  authentication {

    accessKey System.getenv("AWS_ACCESS_KEY_ID")
    secretKey System.getenv("AWS_SECRET_ACCESS_KEY")
  }
}

configurations.all {
  resolutionStrategy {
    force 'org.webkit:android-jsc:r245459'
  }
}

// WHEN_PREPARING_SHELL_REMOVE_FROM_HERE

apply from: 'expo.gradle'

// WHEN_PREPARING_SHELL_REMOVE_TO_HERE

apply from: "../../node_modules/react-native-unimodules/gradle.groovy"

dependencies {
    implementation project(':react-native-torch')
    implementation project(':react-native-twilio-video-webrtc')
    implementation project(':react-native-exit-app')
    implementation project(':react-native-fs')
    implementation project(':react-native-document-picker')
    implementation project(':rn-fetch-blob')
    implementation project(':react-native-onesignal')
    implementation project(':react-native-vector-icons')
    implementation project(':react-native-randombytes')
  implementation fileTree(dir: 'libs', include: ['*.jar'])

  compile project(':tipsi-stripe')

  implementation 'com.android.support:multidex:1.0.1'

  // Our dependencies
  implementation "com.android.support:appcompat-v7:$supportLibVersion"

  // Our dependencies from ExpoView
  // DON'T ADD ANYTHING HERE THAT ISN'T IN EXPOVIEW. ONLY COPY THINGS FROM EXPOVIEW TO HERE.
  implementation "com.android.support:appcompat-v7:$supportLibVersion"
  implementation 'com.facebook.android:facebook-android-sdk:5.0.1'
  implementation('com.facebook.android:audience-network-sdk:5.1.1') {
    exclude module: 'play-services-ads'
  }
  compileOnly 'org.glassfish:javax.annotation:3.1.1'
  implementation 'com.jakewharton:butterknife:9.0.0'
  implementation 'de.greenrobot:eventbus:2.4.0'

  implementation 'com.squareup.picasso:picasso:2.5.2'
  implementation 'com.google.android.gms:play-services-gcm:15.0.1'
  implementation 'com.google.android.gms:play-services-analytics:16.0.1'
  implementation 'com.google.android.gms:play-services-maps:15.0.1'
  implementation 'com.google.android.gms:play-services-auth:15.0.1'
  implementation 'com.google.android.gms:play-services-location:15.0.1'
  implementation 'com.google.android.gms:play-services-ads:15.0.1'
  //annotationProcessor 'com.raizlabs.android:DBFlow-Compiler:2.2.1'
  //implementation "com.raizlabs.android:DBFlow-Core:2.2.1"
  //implementation "com.raizlabs.android:DBFlow:2.2.1"
  implementation "com.madgag.spongycastle:core:1.53.0.0"
  implementation "com.madgag.spongycastle:prov:1.53.0.0"
  debugImplementation 'com.squareup.leakcanary:leakcanary-android-no-op:1.4-beta1'
  // debugImplementation 'com.squareup.leakcanary:leakcanary-android:1.4-beta1'
  releaseImplementation 'com.squareup.leakcanary:leakcanary-android-no-op:1.4-beta1'
  implementation 'com.facebook.device.yearclass:yearclass:2.1.0'
  implementation 'commons-io:commons-io:1.4'
  implementation 'me.leolin:ShortcutBadger:1.1.4@aar'
  implementation 'com.theartofdev.edmodo:android-image-cropper:2.7.0'
  implementation 'commons-codec:commons-codec:1.10'
  implementation 'com.segment.analytics.android:analytics:4.3.0'
  implementation 'com.google.zxing:core:3.3.3'
  implementation 'net.openid:appauth:0.4.1'
  implementation 'com.airbnb.android:lottie:2.5.6'
  implementation('io.nlopez.smartlocation:library:3.2.11') {
    transitive = false
  }
  implementation "com.android.support:exifinterface:${safeExtGet("supportLibVersion", "28.0.0")}"
  implementation 'com.squareup.okio:okio:1.9.0'
  implementation 'com.facebook.soloader:soloader:0.6.0'

  // expo-file-system
  implementation 'com.squareup.okhttp3:okhttp:3.10.0'
  implementation 'com.squareup.okhttp3:okhttp-urlconnection:3.10.0'

  // Testing
  androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.1'
  // We use a modified build of com.android.support.test:runner:1.0.1. Explanation in maven-test/README
  androidTestImplementation 'com.android.support.test:runner:1.0.1'
  androidTestImplementation "com.android.support:support-annotations:${safeExtGet("supportLibVersion", "28.0.0")}"
  androidTestImplementation 'com.google.code.findbugs:jsr305:3.0.0'
  androidTestImplementation 'com.android.support.test.uiautomator:uiautomator-v18:2.1.1'
  androidTestImplementation 'com.azimolabs.conditionwatcher:conditionwatcher:0.2'

  testImplementation 'junit:junit:4.12'
  testImplementation 'org.mockito:mockito-core:1.10.19'
  testImplementation 'org.robolectric:robolectric:3.8'
  testImplementation 'com.android.support.test:runner:1.0.2-alpha1'
  testImplementation 'com.android.support.test:rules:1.0.2-alpha1'


  implementation('host.exp.exponent:expoview:35.0.0@aar') {
    transitive = true
    exclude group: 'com.squareup.okhttp3', module: 'okhttp'
    exclude group: 'com.squareup.okhttp3', module: 'okhttp-urlconnection'
  }




  api 'org.webkit:android-jsc:r245459' // needs to be before react-native
  api 'com.facebook.react:react-native:35.0.0'




  addUnimodulesDependencies([
      modulesPaths : [
        '../../node_modules'
      ],
      configuration: 'api',
      target       : 'react-native',
      exclude      : [
        // You can exclude unneeded modules here.
        // By default we exclude FaceDetector
        // and Stripe payments APIs.
        'unimodules-face-detector-interface',
        'expo-face-detector',
        'expo-payments-stripe'

        // Adding a name here will also remove the package
        // from auto-generated BasePackageList.java
      ]
  ])

}

// This has to be down here for some reason
apply plugin: 'com.google.gms.google-services'
googleServices {
  disableVersionCheck = true
}

Update 3: I've created a signed APK now and tried to validate its signature using jarsigner:

jarsigner -verify -verbose -certs /***/app-release.apk

This command produces the following error:

jarsigner: java.lang.SecurityException: Invalid signature file digest for Manifest main attributes

To me it seems like this might be an important piece to the puzzle. However, I couldn't find any helpful information regarding this error so far.

like image 775
Maximilian Krause Avatar asked Dec 28 '19 11:12

Maximilian Krause


1 Answers

Going to answer my own question here, even though it's not quite a solution to the original problem, more some venting regarding ExpoKit.

I now completely removed ExpoKit from our app. We previously ejected from the managed Expo workflow to ExpoKit since we needed other, native functionality like WebRTC that wasn't supported by Expo yet. However, to be completely honest here, we probably should have ejected to bare React Native instead of semi-optimal ExpoKit.

If you can go with the managed workflow, fine, do it! Definitely makes some stuff easier. However, if you need other, unsupported native functionality, do yourself a favor and go back to bare RN as long as you can do so easily.

Because, going from ExpoKit to bare RN is no charm whatsoever. Had to init a whole new RN project, copy the JavaScript over, reinstall the modules one by one, fix some native issues etc etc - two days of work just to get the app back running.

However, after all that work, now we stand with our same app, just without ExpoKit.

Pros:

  • Uploading the app to Google Play finally works.
  • Reduced app download size by over 70% (!)
  • Ease of autolinking through RN 0.60 (even though ExpoKit supports it as well now iirc with the newest SDK - updating the Expo SDK is a whole science for itself though often times)
  • We can still use Expo modules we actually learned to love like expo-secure-store through unimodules.
  • Might be placebo, but the performance of the app seems to have improved as well.
  • Release app build times increased by about 50% on iOS, 60% on Android
  • App launching seems like it's on speed - while it previously took about 2 to 3 seconds on an iPhone 11 Pro to launch, now it's a matter of milliseconds.

Cons: Couldn't find one so far.

like image 123
Maximilian Krause Avatar answered Nov 10 '22 07:11

Maximilian Krause