繁体   English   中英

来自 React Native 的 Android App Bundle:您上传的 APK 或 Android App Bundle 的某些文件的签名信息无效或缺失

[英]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

我正在尝试首次将应用发布到 Google Play 商店。 我已选择加入 Google Play Signing。 我知道我正在使用正确的密钥对 Android App Bundle 进行签名,因为当我使用另一个密钥上传时,控制台会告诉我使用具有特定 SHA1 标识符的另一个密钥上传。 但是,当我使用正确的密钥上传时,出现此错误:

您上传的 APK 或 Android App Bundle 的某些文件的签名信息无效或缺失。

我正在使用 Android Studio 构建应用程序,如下所示:Build > Generate Signed Bundle / APK > Android App Bundle > 选择我的密钥库并输入密码 > 发布 > 完成

该应用程序是使用分离的 Expo / ExpoKit 构建的 React Native 应用程序。 上传到 Apple App Store 工作正常,我只有 Play Store 有问题。 我错过了什么?

更新 1 :我现在从 Google Play 中完全删除了该应用程序并创建了一个新应用程序。 这次没有选择加入 Google Play Signing 并上传了已签名的 APK。 还是一样的错误。

更新 2 :尝试使用全新的密钥库和密钥。 还是一样。

如果这在某种程度上很重要,这里是项目设置的概述: 项目概况

这是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
}

更新 3 :我现在创建了一个签名的 APK 并尝试使用 jarsigner 验证其签名:

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

此命令会产生以下错误:

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

对我来说,这似乎是拼图的重要组成部分。 但是,到目前为止,我找不到有关此错误的任何有用信息。

在这里回答我自己的问题,尽管它不是原始问题的完全解决方案,但更多的是关于 ExpoKit 的一些发泄。

我现在从我们的应用程序中完全删除了 ExpoKit。 我们之前从托管的 Expo 工作流中退出到 ExpoKit,因为我们需要其他原生功能,例如 Expo 尚不支持的 WebRTC。 然而,在这里说实话,我们可能应该退出React Native 而不是半最优的 ExpoKit。

如果您可以使用托管工作流程,那就行了! 肯定会让一些事情变得更容易。 但是,如果您需要其他不受支持的本机功能,请帮自己一个忙,只要您可以轻松完成,就回到裸 RN。

因为,从 Expo Kit到裸露的 RN 没有任何魅力。 必须初始化一个全新的 RN 项目,复制 JavaScript,一个接一个地重新安装模块,修复一些本机问题等 - 两天的工作只是为了让应用程序重新运行。

然而,在所有这些工作之后,现在我们支持我们的同一个应用程序,只是没有 ExpoKit。

优点:

  • 将应用上传到 Google Play 终于奏效了。
  • 将应用程序下载大小减少了 70% 以上 (!)
  • 易于通过 RN 0.60 自动链接(尽管 ExpoKit 现在也支持使用最新的 SDK iirc - 尽管经常更新 Expo SDK 本身就是一门完整的科学)
  • 我们仍然可以通过 unimodules 使用我们真正学会喜欢的 Expo 模块,例如 expo-secure-store。
  • 可能是安慰剂,但应用程序的性能似乎也有所提高。
  • 发布应用程序构建时间在 iOS 上增加了约 50%,在 Android 上增加了 60%
  • 应用程序的启动速度似乎很快——以前在 iPhone 11 Pro 上启动需要大约 2 到 3 秒,现在只需几毫秒。

缺点:目前没找到。

制作APK或AAB时请务必选择上传作为密钥别名,参考图片。

在此处输入图片说明

可能不是您正在寻找的答案,但您是否尝试过使用命令行生成密钥库,而不是使用 Android Studio。

如果这不起作用,那么我将开始研究模块,尤其是博览会模块,因为它们在过去几周让我感到有些悲伤。

针对 Android 发布的 React Native 指南

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM