aliyun / aliyun-oss-react-native

MIT License
148 stars 101 forks source link

实测, 不支持 react-native 0.60+ #69

Closed quanzaiyu closed 4 years ago

quanzaiyu commented 4 years ago

在 react-native 0.60 版本及以后的版本, 不需要使用 react-native link 命令连接资源, 在安装 aliyun-oss-react-native 后, 编译报错, 即使 gradlew clean 了也仍然报错, 错误的部分详情如下:

"C:\Program Files\nodejs\node.exe" C:\Users\quanzaiyu\AppData\Roaming\npm\node_modules\react-native-cli run-android run-android

Jetifier found 1276 file(s) to forward-jetify. Using 12 workers...
info JS server already running.
info Installing the app...

> Configure project :aliyun-oss-react-native
WARNING: Configuration 'compile' is obsolete and has been replaced with 'implementation' and 'api'.
It will be removed soon. For more information see: http://d.android.com/r/tools/update-dependency-configurations.html

> Task :app:processDebugManifest FAILED

See http://g.co/androidstudio/manifest-merger for more information about the manifest merger.

129 actionable tasks: 2 executed, 127 up-to-date
D:\Documents\life_helper\life_helper_provider\android\app\src\debug\AndroidManifest.xml:20:7-34 Error:
    Attribute application@allowBackup value=(false) from AndroidManifest.xml:20:7-34
    is also present at [com.aliyun.dpa:oss-android-sdk:2.9.2] AndroidManifest.xml:18:9-35 value=(true).
    Suggestion: add 'tools:replace="android:allowBackup"' to <application> element at AndroidManifest.xml:7:5-117 to override.

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':app:processDebugManifest'.
> Manifest merger failed : Attribute application@allowBackup value=(false) from AndroidManifest.xml:20:7-34
    is also present at [com.aliyun.dpa:oss-android-sdk:2.9.2] AndroidManifest.xml:18:9-35 value=(true).
    Suggestion: add 'tools:replace="android:allowBackup"' to <application> element at AndroidManifest.xml:7:5-117 to override.

* 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 7s

Error: Command failed: gradlew.bat app:installDebug -PreactNativeDevServerPort=8081
D:\Documents\life_helper\life_helper_provider\android\app\src\debug\AndroidManifest.xml:20:7-34 Error:
    Attribute application@allowBackup value=(false) from AndroidManifest.xml:20:7-34
    is also present at [com.aliyun.dpa:oss-android-sdk:2.9.2] AndroidManifest.xml:18:9-35 value=(true).
    Suggestion: add 'tools:replace="android:allowBackup"' to <application> element at AndroidManifest.xml:7:5-117 to override.

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':app:processDebugManifest'.
> Manifest merger failed : Attribute application@allowBackup value=(false) from AndroidManifest.xml:20:7-34
    is also present at [com.aliyun.dpa:oss-android-sdk:2.9.2] AndroidManifest.xml:18:9-35 value=(true).
    Suggestion: add 'tools:replace="android:allowBackup"' to <application> element at AndroidManifest.xml:7:5-117 to override.

* 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 7s

    at checkExecSyncError (child_process.js:637:11)
    at execFileSync (child_process.js:655:13)
    at runOnAllDevices (D:\Documents\life_helper\life_helper_provider\node_modules\@react-native-community\cli-platform-android\build\commands\runAndroid\runOnAllDevices.js:94:39)
    at buildAndRun (D:\Documents\life_helper\life_helper_provider\node_modules\@react-native-community\cli-platform-android\build\commands\runAndroid\index.js:158:41)
    at then.result (D:\Documents\life_helper\life_helper_provider\node_modules\@react-native-community\cli-platform-android\build\commands\runAndroid\index.js:125:12)
    at processTicksAndRejections (internal/process/task_queues.js:86:5)
error Failed to install the app. Make sure you have the Android development environment set up: https://facebook.github.io/react-native/docs/getting-started.html#android-development-environment. Run CLI with --verbose flag for more details.

一旦卸载 aliyun-oss-react-native 就没问题了, 希望尽快支持 rn 0.60+, 辛苦了

附上我的系统环境:

$ react-native info
warn The following packages use deprecated "rnpm" config that will stop working from next release:
  - react-native-code-push: https://microsoft.github.io/code-push
Please notify their maintainers about it. You can find more details at https://github.com/react-native-community/cli/blob/master/docs/configuration.md#migration-guide.
info Fetching system and libraries information...
System:
    OS: Windows 10
    CPU: (12) x64 Intel(R) Core(TM) i7-8700 CPU @ 3.20GHz
    Memory: 1.17 GB / 15.87 GB
  Binaries:
    Node: 11.13.0 - C:\Program Files\nodejs\node.EXE
    Yarn: 1.15.2 - C:\Program Files (x86)\Yarn\bin\yarn.CMD
    npm: 6.11.3 - C:\Program Files\nodejs\npm.CMD
  SDKs:
    Android SDK:
      API Levels: 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29
      Build Tools: 25.0.1, 25.0.2, 26.0.0, 27.0.3, 28.0.3, 29.0.0
      System Images: android-24 | Google Play Intel x86 Atom, android-28 | Google Play Intel x86 Atom, android-29 | Google APIs Intel x86 Atom, android-Q | Google Play Int
el x86 Atom
      Android NDK: 20.1.5948944
  IDEs:
    Android Studio: Version  3.4.0.0 AI-183.5429.30.34.5452501
  npmPackages:
    react: ^16.12.0 => 16.12.0
    react-native: 0.61.4 => 0.61.4
Luke-en commented 4 years ago

D:\Documents\life_helper\life_helper_provider\android\app\src\debug\AndroidManifest.xml:20:7-34 Error: Attribute application@allowBackup value=(false) from AndroidManifest.xml:20:7-34 is also present at [com.aliyun.dpa:oss-android-sdk:2.9.2] AndroidManifest.xml:18:9-35 value=(true). Suggestion: add 'tools:replace="android:allowBackup"' to element at AndroidManifest.xml:7:5-117 to override.

报错很明显了啊,按照提示去改一下AndroidManifest就好了

quanzaiyu commented 4 years ago

谢谢, 问题已修复, 修改 AndroidManifest.xml 对应位置为以下内容即可:

android:allowBackup="true"
AnnaSearl commented 3 years ago
android:allowBackup="true"

您好,请问是怎么改的,是改 android\app\src\debug\AndroidManifest.xml 这个文件么,修改后的文件能分享下么,我根据你前面的答案试了好久都不行,不知道 “对应位置” 指的具体是什么位置。。。

quanzaiyu commented 3 years ago

@AnnaSearl 肯定不是改debug的啊,是main下的 image