[英]Ios version of app works, but Android fails due to no suitable constructor found for AccessToken for React Native App
[英]Cannot build Android Version of my App due to react-native-orientation
我在我的項目中使用了react-native-orientation
package,並使用 npx npx pod-install
鏈接它。 這適用於 iOS,現在我的應用程序已在 App Store 上完全發布。 然后,當我嘗試創建 Android 版本時,我不斷從 Android Studio 收到以下錯誤:
A problem occurred evaluating project ':app'.
> Could not find method compile() for arguments [project ':react-native-orientation'] on object of type org.gradle.api.internal.artifacts.dsl.dependencies.DefaultDependencyHandler.
然后,我遵循了將react-native-orientation
鏈接到 Android 目錄的手動說明,但它什么也沒做。 我知道pod-install
僅適用於 iOS,但現在已棄用react-native link
,不是嗎? 我什至無法運行它,因為它只是告訴我link
是無法識別的命令。 因此,如果手動鏈接不起作用,並且自動鏈接顯然不存在,我有什么行動方案?
嘗試使用補丁包
問題是在 gradlew 7 上,'compile' 關鍵字被棄用,取而代之的是 'implementation'。
正確的方法不是在 /node_modules/ 文件夾內更改,而是打補丁。 在我的例子中,我不得不手動修改補丁包制作的自動補丁。
這個問題對我有幫助: https://github.com/yamill/react-native-orientation/issues/407
補丁如下(不要復制前兩行,讓補丁包創建):
diff --git a/node_modules/react-native-orientation/android/src/main/java/com/github/yamill/orientation/OrientationModule.java b/node_modules/react-native-orientation/android/src/main/java/com/github/yamill/orientation/OrientationModule.java
index 85331ae..787f60f 100644
--- a/node_modules/react-native-orientation/android/build.gradle
+++ b/node_modules/react-native-orientation/android/build.gradle
@@ -16,5 +16,5 @@ android {
}
dependencies {
- compile "com.facebook.react:react-native:+"
+ implementation "com.facebook.react:react-native:+"
}
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.