yorkie / react-native-wechat

🚀 WeChat login, share, favorite and payment for React-Native on iOS and Android platforms (QQ: 336021910)
https://npmjs.org/package/react-native-wechat
MIT License
2.91k stars 711 forks source link

android打包apk失败 #413

Open yuanfangluo opened 5 years ago

yuanfangluo commented 5 years ago
2018-12-09 2 57 24

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

heyuncoder commented 5 years ago

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

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
jiangliuer326442 commented 5 years ago

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

zhangdszq commented 5 years ago

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

heyuncoder commented 5 years ago

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

Nocturne-FFG commented 5 years ago

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

EvanMaFYH commented 5 years ago

在android/build.gradle中增加:


subprojects {
    afterEvaluate {project ->
        if (project.hasProperty("android")) {
            android {
                compileSdkVersion 27
                buildToolsVersion '27.0.3'
            }
        }
    }
}
simonnet126 commented 5 years ago

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

erdong0604 commented 5 years ago

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

nice!!!