react-native-wechat icon indicating copy to clipboard operation
react-native-wechat copied to clipboard

android打包apk失败

Open yuanfangluo opened this issue 6 years ago • 8 comments

2018-12-09 2 57 24 开发调试没有问题., 但是准备打包apk的时候出现这个问题了,求指教?

yuanfangluo avatar Dec 09 '18 06:12 yuanfangluo

我也遇到无法打包的问题,调试的时候没有问题 打包的时候出现以下错误

error: resource android:style/TextAppearance.Material.Widget.Button.Borderless.Colored not found.
error: resource android:style/TextAppearance.Material.Widget.Button.Colored not found.
/Users/sunny/.gradle/caches/transforms-1/files-1.1/appcompat-v7-27.1.1.aar/5f8623fb70f7cc24f658af5ac047b464/res/values-v26/values-v26.xml:9:5-12:13: AAPT: error: resource android:attr/colorError not found.

/Users/sunny/.gradle/caches/transforms-1/files-1.1/appcompat-v7-27.1.1.aar/5f8623fb70f7cc24f658af5ac047b464/res/values-v26/values-v26.xml:13:5-16:13: AAPT: error: resource android:attr/colorError not found.

/Users/sunny/.gradle/caches/transforms-1/files-1.1/appcompat-v7-27.1.1.aar/5f8623fb70f7cc24f658af5ac047b464/res/values-v26/values-v26.xml:17:5-93: AAPT: error: style attribute 'android:attr/keyboardNavigationCluster' not found.

/Users/sunny/.gradle/caches/transforms-1/files-1.1/appcompat-v7-27.1.1.aar/5f8623fb70f7cc24f658af5ac047b464/res/values/values.xml:251:5-69: AAPT: error: resource android:attr/fontStyle not found.

/Users/sunny/.gradle/caches/transforms-1/files-1.1/appcompat-v7-27.1.1.aar/5f8623fb70f7cc24f658af5ac047b464/res/values/values.xml:251:5-69: AAPT: error: resource android:attr/font not found.

/Users/sunny/.gradle/caches/transforms-1/files-1.1/appcompat-v7-27.1.1.aar/5f8623fb70f7cc24f658af5ac047b464/res/values/values.xml:251:5-69: AAPT: error: resource android:attr/fontWeight not found.

error: failed linking references.

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':RCTWeChat:verifyReleaseResources'.
> com.android.ide.common.process.ProcessException: Failed to execute aapt

* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.

* Get more help at https://help.gradle.org

BUILD FAILED in 2s
25 actionable tasks: 1 executed, 24 up-to-date

react-native版本: react-native info

React Native Environment Info:
    System:
      OS: macOS High Sierra 10.13.5
      CPU: (4) x64 Intel(R) Core(TM) i5-7360U CPU @ 2.30GHz
      Memory: 412.95 MB / 8.00 GB
      Shell: 5.3 - /bin/zsh
    Binaries:
      Node: 8.11.3 - ~/.nvm/versions/node/v8.11.3/bin/node
      Yarn: 1.9.4 - ~/.nvm/versions/node/v8.11.3/bin/yarn
      npm: 5.6.0 - ~/.nvm/versions/node/v8.11.3/bin/npm
      Watchman: 4.9.0 - /usr/local/bin/watchman
    SDKs:
      iOS SDK:
        Platforms: iOS 11.4, macOS 10.13, tvOS 11.4, watchOS 4.3
      Android SDK:
        API Levels: 23, 26, 27, 28
        Build Tools: 23.0.1, 26.0.3, 27.0.3, 28.0.1
        System Images: android-28 | Google Play Intel x86 Atom
    IDEs:
      Android Studio: 3.1 AI-173.4819257
      Xcode: 9.4.1/9F2000 - /usr/bin/xcodebuild
    npmPackages:
      react: 16.6.1 => 16.6.1
      react-native: 0.57.7 => 0.57.7
    npmGlobalPackages:
      react-native-cli: 2.0.1
      react-native-update-cli: 0.1.0

heyuncoder avatar Dec 12 '18 09:12 heyuncoder

我也遇到了上面的问题,还是自己重新写一个吧~

jiangliuer326442 avatar Dec 12 '18 16:12 jiangliuer326442

参考这文章:https://blog.csdn.net/klo220/article/details/83380657 修改 ./node_modules/react-native-wechat/android/build.gradle

zhangdszq avatar Dec 15 '18 09:12 zhangdszq

@jiangliuer326442 最后也是参照源码,自己重写了一遍

heyuncoder avatar Dec 16 '18 12:12 heyuncoder

咋办啊,同样是这个问题,不懂原生自己不会写啊,马上要发布上线了,天啊,救命啊

Nocturne-FFG avatar Dec 21 '18 07:12 Nocturne-FFG

在android/build.gradle中增加:

subprojects {
    afterEvaluate {project ->
        if (project.hasProperty("android")) {
            android {
                compileSdkVersion 27
                buildToolsVersion '27.0.3'
            }
        }
    }
}

EvanMaFYH avatar Mar 06 '19 01:03 EvanMaFYH

需要将\node_modules\react-native-wechat\android\build.gradle 里的compile 修改为api(注意修改为implementation会出错) 把compileSdkVersion buildToolsVersion targetSdkVersion 修改为编译器一致

simonnet126 avatar Mar 14 '19 07:03 simonnet126

需要将\node_modules\react-native-wechat\android\build.gradle 里的compile 修改为api(注意修改为implementation会出错) 把compileSdkVersion buildToolsVersion targetSdkVersion 修改为编译器一致

nice!!!

erdong0604 avatar Aug 22 '19 08:08 erdong0604