我正在尝试发布我的第一个Android / React Native应用程序。
我按照签署你的应用谷歌页面(https://developer.android.com/studio/publish/app-signing)和生成签名APK反应原生页面(https://facebook.github.io/react-native/docs/signed-apk-android),我不能生成APK正确。
你有什么想法吗?谢谢你。
我在尝试生成签名的APK时收到一条奇怪的错误消息“没有这样的规模”。密钥库文件不在项目中,因此签名信息不在 app projet 中。
我试过了
>
rm-rf节点_模块
Android Studio
APK生成
$./gradlew assembleRelease --stacktrace --info [...] > Task :app:bundleReleaseJsAndAssets Putting task artifact state for task ':app:bundleReleaseJsAndAssets' into context took 0.0 secs. Executing task ':app:bundleReleaseJsAndAssets' (up-to-date check took 0.839 secs) due to: Task has failed previously. Starting process 'command 'node''. Working directory: MyApp Command: node node_modules/react-native/local-cli/cli.js bundle --platform android --dev false --reset-cache --entry-file index.js --bundle-output MyApp/android/app/build/intermediates/assets/release/index.android.bundle --assets-dest MyApp/android/app/build/intermediates/res/merged/release Successfully started process 'command 'node'' Scanning folders for symlinks in MyApp/node_modules (21ms) Scanning folders for symlinks in MyApp/node_modules (24ms) Loading dependency graph, done. warning: the transform cache was reset. bundle: start bundle: finish bundle: Writing bundle output to: MyApp/android/app/build/intermediates/assets/release/index.android.bundle bundle: Done writing bundle output no such scale :app:bundleReleaseJsAndAssets (Thread[Task worker for ':' Thread 3,5,main]) completed. Took 2 mins 1.325 secs. FAILURE: Build failed with an exception. * What went wrong: Execution failed for task ':app:bundleReleaseJsAndAssets'. > Process 'command 'node'' finished with non-zero exit value 1 * Try: Run with --debug option to get more log output. * Exception is: org.gradle.api.tasks.TaskExecutionException: Execution failed for task ':app:bundleReleaseJsAndAssets'. at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.executeActions(ExecuteActionsTaskExecuter.java:100) at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.execute(ExecuteActionsTaskExecuter.java:70) at org.gradle.api.internal.tasks.execution.SkipUpToDateTaskExecuter.execute(SkipUpToDateTaskExecuter.java:63) at org.gradle.api.internal.tasks.execution.ResolveTaskOutputCachingStateExecuter.execute(ResolveTaskOutputCachingStateExecuter.java:54) at org.gradle.api.internal.tasks.execution.ValidatingTaskExecuter.execute(ValidatingTaskExecuter.java:58) at org.gradle.api.internal.tasks.execution.SkipEmptySourceFilesTaskExecuter.execute(SkipEmptySourceFilesTaskExecuter.java:88) at org.gradle.api.internal.tasks.execution.ResolveTaskArtifactStateTaskExecuter.execute(ResolveTaskArtifactStateTaskExecuter.java:52) at org.gradle.api.internal.tasks.execution.SkipTaskWithNoActionsExecuter.execute(SkipTaskWithNoActionsExecuter.java:52) at org.gradle.api.internal.tasks.execution.SkipOnlyIfTaskExecuter.execute(SkipOnlyIfTaskExecuter.java:54) at org.gradle.api.internal.tasks.execution.ExecuteAtMostOnceTaskExecuter.execute(ExecuteAtMostOnceTaskExecuter.java:43) at org.gradle.api.internal.tasks.execution.CatchExceptionTaskExecuter.execute(CatchExceptionTaskExecuter.java:34) at org.gradle.execution.taskgraph.DefaultTaskGraphExecuter$EventFiringTaskWorker$1.run(DefaultTaskGraphExecuter.java:248) at org.gradle.internal.progress.DefaultBuildOperationExecutor$RunnableBuildOperationWorker.execute(DefaultBuildOperationExecutor.java:336) at org.gradle.internal.progress.DefaultBuildOperationExecutor$RunnableBuildOperationWorker.execute(DefaultBuildOperationExecutor.java:328) at org.gradle.internal.progress.DefaultBuildOperationExecutor.execute(DefaultBuildOperationExecutor.java:197) at org.gradle.internal.progress.DefaultBuildOperationExecutor.run(DefaultBuildOperationExecutor.java:107) at org.gradle.execution.taskgraph.DefaultTaskGraphExecuter$EventFiringTaskWorker.execute(DefaultTaskGraphExecuter.java:241) at org.gradle.execution.taskgraph.DefaultTaskGraphExecuter$EventFiringTaskWorker.execute(DefaultTaskGraphExecuter.java:230) at org.gradle.execution.taskgraph.DefaultTaskPlanExecutor$TaskExecutorWorker.processTask(DefaultTaskPlanExecutor.java:124) at org.gradle.execution.taskgraph.DefaultTaskPlanExecutor$TaskExecutorWorker.access$200(DefaultTaskPlanExecutor.java:80) at org.gradle.execution.taskgraph.DefaultTaskPlanExecutor$TaskExecutorWorker$1.execute(DefaultTaskPlanExecutor.java:105) at org.gradle.execution.taskgraph.DefaultTaskPlanExecutor$TaskExecutorWorker$1.execute(DefaultTaskPlanExecutor.java:99) at org.gradle.execution.taskgraph.DefaultTaskExecutionPlan.execute(DefaultTaskExecutionPlan.java:625) at org.gradle.execution.taskgraph.DefaultTaskExecutionPlan.executeWithTask(DefaultTaskExecutionPlan.java:580) at org.gradle.execution.taskgraph.DefaultTaskPlanExecutor$TaskExecutorWorker.run(DefaultTaskPlanExecutor.java:99) at org.gradle.internal.concurrent.ExecutorPolicy$CatchAndRecordFailures.onExecute(ExecutorPolicy.java:63) at org.gradle.internal.concurrent.ManagedExecutorImpl$1.run(ManagedExecutorImpl.java:46) at org.gradle.internal.concurrent.ThreadFactoryImpl$ManagedThreadRunnable.run(ThreadFactoryImpl.java:55) Caused by: org.gradle.process.internal.ExecException: Process 'command 'node'' finished with non-zero exit value 1 at org.gradle.process.internal.DefaultExecHandle$ExecResultImpl.assertNormalExitValue(DefaultExecHandle.java:380) at org.gradle.process.internal.DefaultExecAction.execute(DefaultExecAction.java:31) at org.gradle.api.tasks.AbstractExecTask.exec(AbstractExecTask.java:54) at org.gradle.internal.reflect.JavaMethod.invoke(JavaMethod.java:73) at org.gradle.api.internal.project.taskfactory.DefaultTaskClassInfoStore$StandardTaskAction.doExecute(DefaultTaskClassInfoStore.java:141) at org.gradle.api.internal.project.taskfactory.DefaultTaskClassInfoStore$StandardTaskAction.execute(DefaultTaskClassInfoStore.java:134) at org.gradle.api.internal.project.taskfactory.DefaultTaskClassInfoStore$StandardTaskAction.execute(DefaultTaskClassInfoStore.java:121) at org.gradle.api.internal.AbstractTask$TaskActionWrapper.execute(AbstractTask.java:731) at org.gradle.api.internal.AbstractTask$TaskActionWrapper.execute(AbstractTask.java:705) at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter$1.run(ExecuteActionsTaskExecuter.java:122) at org.gradle.internal.progress.DefaultBuildOperationExecutor$RunnableBuildOperationWorker.execute(DefaultBuildOperationExecutor.java:336) at org.gradle.internal.progress.DefaultBuildOperationExecutor$RunnableBuildOperationWorker.execute(DefaultBuildOperationExecutor.java:328) at org.gradle.internal.progress.DefaultBuildOperationExecutor.execute(DefaultBuildOperationExecutor.java:197) at org.gradle.internal.progress.DefaultBuildOperationExecutor.run(DefaultBuildOperationExecutor.java:107) at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.executeAction(ExecuteActionsTaskExecuter.java:111) at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.executeActions(ExecuteActionsTaskExecuter.java:92) ... 27 more * Get more help at https://help.gradle.org BUILD FAILED in 2m 3s 50 actionable tasks: 2 executed, 48 up-to-date
gradle.properties
android.useDeprecatedNdk=true Keys.repo=/<absolute_path_away_project>/Android_certificates/
keystores/release . keystore . properties
keyAlias='SigningKeyAlias' keyPassword='<password_string>' storeFile='<store_filename' storePassword='<password_store'
app.gradle
apply plugin: "com.android.application" import com.android.build.OutputFile project.ext.react = [ entryFile: "index.js" ] apply from: "../../node_modules/react-native/react.gradle" def enableSeparateBuildPerCPUArchitecture = false def enableProguardInReleaseBuilds = true // Create a variable called keystorePropertiesFile, and initialize it to your // release.keystore.properties file, in the rootProject folder. def keystorePropertiesFile = file("keystores/release.keystore.properties") // Initialize a new Properties() object called keystoreProperties. def keystoreProperties = new Properties() // Load your keystore.properties file into the keystoreProperties object. keystoreProperties.load(new FileInputStream(keystorePropertiesFile)) def projectPropsFile = file(project.property("Keys.repo") + keystoreProperties['storeFile']) android { signingConfigs { release { storeFile projectPropsFile storePassword keystoreProperties['storePassword'] keyAlias keystoreProperties['keyAlias'] keyPassword keystoreProperties['keyPassword'] } } compileSdkVersion 26 buildToolsVersion '26.0.2' defaultConfig { applicationId "com.myapp" minSdkVersion 16 targetSdkVersion 22 versionCode 1 versionName "1.0" ndk { abiFilters "armeabi-v7a", "x86" } } splits { abi { reset() enable enableSeparateBuildPerCPUArchitecture universalApk false // If true, also generate a universal APK include "armeabi-v7a", "x86" } } buildTypes { release { minifyEnabled enableProguardInReleaseBuilds proguardFiles getDefaultProguardFile("proguard-android.txt"), "proguard-rules.pro" signingConfig signingConfigs.release debuggable true jniDebuggable true renderscriptDebuggable true } } // applicationVariants are e.g. debug, release applicationVariants.all { variant -> variant.outputs.each { output -> // For each separate APK per architecture, set a unique version code as described here: // http://tools.android.com/tech-docs/new-build-system/user-guide/apk-splits def versionCodes = ["armeabi-v7a": 1, "x86": 2] def abi = output.getFilter(OutputFile.ABI) if (abi != null) { // null for the universal-debug, universal-release variants output.versionCodeOverride = versionCodes.get(abi) * 1048576 + defaultConfig.versionCode } } } } dependencies { implementation 'com.google.firebase:firebase-messaging:17.1.0' compile project(':react-native-push-notification-ce') compile project(':react-native-vector-icons') compile project(':react-native-i18n') compile project(':react-native-config') compile fileTree(include: ['*.jar'], dir: 'libs') compile 'com.android.support:appcompat-v7:23.0.1' compile 'com.facebook.react:react-native:+' // From node_modules compile 'com.google.firebase:firebase-core:16.0.1' } // Run this once to be able to run the application with BUCK // puts all compile dependencies into folder libs for BUCK to use task copyDownloadableDepsToLibs(type: Copy) { from configurations.compile into 'libs' } apply plugin: 'com.google.gms.google-services'
如下所示:https://developer.android.com/training/multiscreen/screendensities.如果存在无效的dpi(即使只有一个),则不会编译图像。
在我的情况下,原因是我有无效(?)图像文件名中的dpi说明符。
我的设备dpi是400,所以我有像myimage@2.5x.png
这样的文件。调试版本构建得很好,但不是发布版本。一旦我将2.5更改为2,发布版本就被构建了。
希望它有帮助。
我正在尝试生成签名APK。但由于生成时的lint错误而无法生成。我检查了我的lint报告,它在我的XML文件中显示错误。 林特在组装释放目标时发现致命错误。要继续,要么修复lint识别的问题,要么修改构建脚本,如下所示:...android{lintOptions{checkReleaseBuilds false//或者,如果您愿意,您可以继续检查版本构建中的错误,//但即使发现错误,也可以继续构
我正在尝试构建我的第一个签名APK以供发布,但出现了一些错误。看起来效果很好,但现在我就是无法生成APK。我做了研究,但什么也没找到。 Gradle版本:4.8,Android插件版本3.1.4,这是我的应用程序Gradle屏幕截图:link 这来自assembleDebug: 我曾经有过布局和不赞成使用的功能的其他问题,但我解决了它。其中一个就这样消失了,但我什么也没做:-) 我已经尝试过的事情
但我的问题是,当我从Eclipse导出项目以生成签名apk时,它不允许使用现有的密钥库;此外,当我选择existing keystore时,别名的下拉列表为空。所以每次我都要创建新的密钥库。在选择退出密钥存储时,它还显示“无效密钥存储格式”。请提供我的一些解决方案,以我如何生成一个APK与相同的SHA-1密钥。
通过以下命令提到留档,我试图生成签名apk android和得到以下错误 按照此链接生成生产apk http://facebook.github.io/react-native/docs/signed-apk-android.html 生成后通过以下命令构建apk成功生成 但是在安装apk启动后崩溃,并出现以下错误。
在生成签名的apk时,我遇到了以下错误: 错误:任务“:app:TransformClassesWithJarmergingForDebug”执行失败。com.android.build.api.transform.transformException:java.util.zip.zipException:重复条目:Android/support/v13/view/DragandDropPermi