簡體   English   中英

我的 React Native android 應用程序未運行(任務:應用程序:mergeDebugNativeLibs 失敗)

[英]My React Native android app is not running (Task :app:mergeDebugNativeLibs FAILED)

在將 android gradle 更新為“classpath 'com.android.tools.build.gradle:3.6.3'”並添加“kotlin_version='1.6.0'”后,我無法運行本機 android 應用程序。

**我的 android --> build.gradle **

buildscript {
    ext {
        buildToolsVersion = "29.0.2"
        minSdkVersion = 19
        compileSdkVersion = 31
        targetSdkVersion = 31
        googlePlayServicesAuthVersion = "16.0.1"
        kotlin_version='1.6.0' //add This change version with your installed kotlin version
    }
 dependencies {
        classpath 'com.android.tools.build:gradle:3.6.3'
        classpath 'com.google.gms:google-services:4.3.4'
        classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version" //add This

        // NOTE: Do not place your application dependencies here; they belong
        // in the individual module build.gradle files
    }
allprojects {
    repositories {
        mavenLocal()
        maven {
            // All of React Native (JS, Obj-C sources, Android binaries) is installed from npm
            url("$rootDir/../node_modules/react-native/android")
        }
        maven {
            // Android JSC is installed from npm
            url("$rootDir/../node_modules/jsc-android/dist")
        }
        mavenCentral()
        google()
        jcenter()
        maven { url 'https://jitpack.io' }
    }
}

** 面臨錯誤 **

此版本中使用了已棄用的 Gradle 功能,使其與 Gradle 7.0 不兼容。 使用“--warning-mode all”來顯示各個棄用警告。 請參閱https://docs.gradle.org/6.3/userguide/command_line_interface.html#sec:command_line_warnings 608 個可操作任務:2 個已執行,606 個是最新的警告:映射新 ns http://schemas.882461884094 repository/android/common/02到舊 ns http://schemas.android.com/repository/android/common/01警告:將新 ns http://schemas.android.com/repository/android/generic/02映射到舊 ns http://schemas.android.com/repository/android/generic/01

* What went wrong:
Execution failed for task ':app:mergeDebugNativeLibs'.
> A failure occurred while executing com.android.build.gradle.internal.tasks.Workers$ActionFacade
   > More than one file was found with OS independent path 'lib/armeabi-v7a/libfbjni.so'

錯誤截圖

我添加了 kotlin 版本並將 gradle 更改為“3.6.3”,我預計它會在添加 kotlin 和 gradle 版本更改后運行,但我無法打開應用程序。

將其添加到 android/buld.gradle 文件的 allprojects 區域。

def REACT_NATIVE_VERSION = new File(['node', '--print',"JSON.parse(require('fs').readFileSync(require.resolve('react-native/package.json'), 'utf-8')).version"].execute(null, rootDir).text.trim())

allprojects {
    configurations.all {
        resolutionStrategy {
            // Remove this override in 0.65+, as a proper fix is included in react-native itself.
            force "com.facebook.react:react-native:" + REACT_NATIVE_VERSION
        }
    }

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM