美文网首页React Native
react-native 0.51安卓打包错误总结

react-native 0.51安卓打包错误总结

作者: zy_mr | 来源:发表于2018-07-26 18:28 被阅读1143次

打包出来之后的包名如果不为app-release,而且安装到手机时报-103错误的话,是未给程序设置好签名文件...可参考
https://blog.csdn.net/u011272795/article/details/77161942打包流程

打包过程中报下面的错误

C:\Users\state200\.gradle\caches\transforms-1\files-1.1\appcompat-v7-27.1.0.aar\f63492c23cc0298fedefd779ab518c57\res\values-v26\values-v26.xml:9:5-12:13: AAPT: resource android:attr/colorError not found.

C:\Users\state200\.gradle\caches\transforms-1\files-1.1\appcompat-v7-27.1.0.aar\f63492c23cc0298fedefd779ab518c57\res\values-v26\values-v26.xml:13:5-16:13: AAPT: resource android:attr/colorError not found.

C:\Users\state200\.gradle\caches\transforms-1\files-1.1\appcompat-v7-27.1.0.aar\f63492c23cc0298fedefd779ab518c57\res\values-v26\values-v26.xml:17:5-93: AAPT: style attribute 'android:attr/keyboardNavigationCluster' not found.

C:\Users\state200\.gradle\caches\transforms-1\files-1.1\appcompat-v7-27.1.0.aar\f63492c23cc0298fedefd779ab518c57\res\values\values.xml:251:5-69: AAPT: resource android:attr/fontStyle not found.

C:\Users\state200\.gradle\caches\transforms-1\files-1.1\appcompat-v7-27.1.0.aar\f63492c23cc0298fedefd779ab518c57\res\values\values.xml:251:5-69: AAPT: resource android:attr/font not found.

C:\Users\state200\.gradle\caches\transforms-1\files-1.1\appcompat-v7-27.1.0.aar\f63492c23cc0298fedefd779ab518c57\res\values\values.xml:251:5-69: AAPT: resource android:attr/fontWeight not found.

D:\doctorTest\rabbitDoctor\node_modules\react-native-fs\android\build\intermediates\res\merged\release\values-v26\values-v26.xml:7: error: resource android:attr/colorError not found.

D:\doctorTest\rabbitDoctor\node_modules\react-native-fs\android\build\intermediates\res\merged\release\values-v26\values-v26.xml:11: error: resource android:attr/colorError not found.

D:\doctorTest\rabbitDoctor\node_modules\react-native-fs\android\build\intermediates\res\merged\release\values-v26\values-v26.xml:15: error: style attribute 'android:attr/keyboardNavigationCluster' not found.

D:\doctorTest\rabbitDoctor\node_modules\react-native-fs\android\build\intermediates\res\merged\release\values\values.xml:226: error: resource android:attr/fontStyle not found.

D:\doctorTest\rabbitDoctor\node_modules\react-native-fs\android\build\intermediates\res\merged\release\values\values.xml:226: error: resource android:attr/font not found.

D:\doctorTest\rabbitDoctor\node_modules\react-native-fs\android\build\intermediates\res\merged\release\values\values.xml:226: error: resource android:attr/fontWeight not found.

error: failed linking references.

FAILURE: Build failed with an exception.

* What went wrong:

Execution failed for task ':react-native-fs:verifyReleaseResources'.

> com.android.ide.common.process.ProcessException: Failed to execute aapt

解决方法 查看android/app/build.gradle 中的

android {

compileSdkVersion 27   //这里版本

buildToolsVersion "27.0.0"  //这里版本

defaultConfig {

applicationId "com.doctor"

minSdkVersion 16

targetSdkVersion 27   //这里版本

versionCode 1

versionName "1.0"

vectorDrawables.useSupportLibrary = true

ndk {

abiFilters "armeabi-v7a", "x86"

}

}

.......

dependencies {

compile project(':react-native-fs')

compile project(':react-native-picker')

compile project(':react-native-linear-gradient')

compile project(':react-native-image-crop-picker')

compile fileTree(dir: "libs", include: ["*.jar"])

compile "com.android.support:appcompat-v7:23.0.1"  //这里的版本修改为下面的

compile "com.android.support:appcompat-v7:27.0.1"

compile "com.facebook.react:react-native:+"  // From node_modules

compile (project(':react-native-camera')) {

exclude group: "com.google.android.gms"

compile 'com.android.support:exifinterface:25.+'

compile ('com.google.android.gms:play-services-vision:12.0.1') {

force = true

}

}

}

还有在android/app/src/AndroidManifest.xml中的

    android:minSdkVersion="16"

    android:targetSdkVersion="27" /> 修改跟上面中的build.gradle一样   

如果报错

Caused by: com.android.tools.aapt2.Aapt2Exception: AAPT2 error: check logs for details

        at com.android.builder.png.AaptProcess$NotifierProcessOutput.handleOutput(AaptProcess.java:463)

        at com.android.builder.png.AaptProcess$NotifierProcessOutput.err(AaptProcess.java:415)

        at com.android.builder.png.AaptProcess$ProcessOutputFacade.err(AaptProcess.java:332)

        at com.android.utils.GrabProcessOutput$1.run(GrabProcessOutput.java:104)

在android/gradle.properties中的最后增加一行

android.enableAapt2=false

报错

Warning: com.google.android.cameraview.CameraView.Flash: The typedef annotation should have @Retention(RetentionPolicy.SOURCE)

C:\Users\state200\.gradle\caches\transforms-1\files-1.1\appcompat-v7-27.1.0.aar\f63492c23cc0298fedefd779ab518c57\res\values-v26\values-v26.xml:13:5-16:13: AAPT: No resource found that matches the given name: attr 'android:keyboardNavigationCluster'.

D:\doctorTest\rabbitDoctor\node_modules\react-native-fs\android\build\intermediates\res\merged\release\values-v26\values-v26.xml:15: error: Error: No resource found that matches the given name: attr 'android:keyboardNavigationCluster'.```

解决方法     在android/build.gradle这个文件最后增加

subprojects {

afterEvaluate {project ->

if (project.hasProperty("android")) {

android {

compileSdkVersion 27    

buildToolsVersion "27.0.2"

}

}

}

}

报错

Execution failed for task ':app:transformDexWithDexForRelease'.

> com.android.build.api.transform.TransformException: com.android.ide.common.process.ProcessException: java.util.concurrent.ExecutionException: com.android.ide.common.process.ProcessException:

解决方法  android/app/build.gradle这个文件中 

defaultConfig {

applicationId "com.doctor"

minSdkVersion 16

targetSdkVersion 27

versionCode 1

versionName "1.0"

multiDexEnabled true   增加这一行

vectorDrawables.useSupportLibrary = true

ndk {

abiFilters "armeabi-v7a", "x86"

}

}

相关文章

网友评论

    本文标题:react-native 0.51安卓打包错误总结

    本文链接:https://www.haomeiwen.com/subject/xyabmftx.html