错误是—>任务’:app:processReleaseResources’的执行失败.
我按照文档Generate signed apk
生成apk.当我发出命令cd android&& ./gradlew assembleRelease然后我收到了这个错误.
我的build.grade文件是—>
`
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 = false
android {
compileSdkVersion 25
buildToolsversion '25.0.3'
defaultConfig {
applicationId "com.newsapp"
minSdkVersion 16
targetSdkVersion 25
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"
}
}
signingConfigs {
release {
if (project.hasProperty('MYAPP_RELEASE_STORE_FILE')) {
storeFile file(MYAPP_RELEASE_STORE_FILE)
storePassword MYAPP_RELEASE_STORE_PASSWORD
keyAlias MYAPP_RELEASE_KEY_ALIAS
keyPassword MYAPP_RELEASE_KEY_PASSWORD
}
}
}
buildTypes {
release {
minifyEnabled enableProguardInReleaseBuilds
proguardFiles getDefaultProguardFile("proguard-android.txt"), "proguard-rules.pro"
signingConfig signingConfigs.release
}
}
// 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 {
compile project(':react-native-vector-icons')
compile project(':react-native-linear-gradient')
compile project(':react-native-photo-view')
compile project(':react-native-linear-gradient')
compile project(':react-native-vector-icons')
compile project(':react-native-vector-icons')
compile project(':react-native-linear-gradient')
compile project(':react-native-photo-view')
compile project(':react-native-linear-gradient')
compile project(':react-native-vector-icons')
compile filetree(dir: "libs", include: ["*.jar"])
compile "com.android.support:appcompat-v7:23.0.1"
compile "com.facebook.react:react-native:+" // From node_modules
}
// 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'
}
`
请帮我解决这个问题.我可以在调试模式下运行我的应用程序,但我无法生成realease apk.
解决方法:
我解决了这个问题.
问题在于反应导航模块.使用最新版本的gradle,它无法在react-navigation文件夹中编译图像.所以我删除了图像并运行命令然后它工作.
这个doc帮助我解决了这个问题.