簡體   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