构建Android的React Native Navigation Error,:app @ debug / compileClasspath':无法解析项目:react-native-navigation

时间:2018-03-19 14:03:19

标签: android react-native react-native-android react-native-navigation

我正在尝试安装react-native-navigation(wix)包,我正在按照android(https://wix.github.io/react-native-navigation/#/installation-android)上的步骤进行操作,但在android studio中,构建失败并显示消息。 Gradle 4.1(我不知道这是否相关)

Could not resolve project :react-native-navigation.
Required by:
project :app

Unable to find a matching configuration of project :react-native-navigation: None of the consumable configurations have attributes.

Error:Unable to resolve dependency for ':app@debug/compileClasspath': Could not resolve project :react-native-navigation.
Open File
Show Details

Error:Unable to resolve dependency for ':app@debugAndroidTest/compileClasspath': Could not resolve project :react-native-navigation.
Open File
Show Details

Error:Unable to resolve dependency for ':app@debugUnitTest/compileClasspath': Could not resolve project :react-native-navigation.
Open File
Show Details

Error:Unable to resolve dependency for ':app@release/compileClasspath': Could not resolve project :react-native-navigation.
Open File
Show Details

Error:Unable to resolve dependency for ':app@releaseUnitTest/compileClasspath': Could not resolve project :react-native-navigation.

我在下面留下详细信息(我的用户称为家庭,不是拼写错误):

问题说明 local.properties文件

sdk.dir=/home/home/Android/Sdk

settings.gradle

include ':app'
include ':react-native-navigation'
project(':react-native-navigation').projectDir = new File(rootProject.projectDir, '../node_modules/react-native-navigation/android/app/')
App gradle file

apply plugin: 'com.android.application'

android {
    compileSdkVersion 25
    defaultConfig {
        applicationId "com.example.home.myapplication"
        minSdkVersion 15
        targetSdkVersion 25
        versionCode 1
        versionName "1.0"
        testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
    }
    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
    }
}

dependencies {
    implementation fileTree(dir: 'libs', include: ['*.jar'])
    implementation "com.android.support:appcompat-v7:25.0.1"
    implementation 'com.android.support.constraint:constraint-layout:1.0.2'
    testImplementation 'junit:junit:4.12'
    androidTestImplementation 'com.android.support.test:runner:1.0.1'
    androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.1'
   //tried implementation as well here instead of compile but didn't work either 
   compile project(':react-native-navigation')

}

环境

  • React Native Navigation版本:“1.1.370”
  • React原生版:“0.52.0”
  • 平台(iOS,Android或两者兼有?):Android
  • 设备信息(模拟器/设备?操作系统版本?调试/发布?):Android Studio

我应该使用哪个版本的gradle和android api with native native?有什么方法可以解决这个问题吗?我看到我的app gradle文件与指令无关,编译项目语句在我的gradle版本中无效。任何的想法?也许local.settings是错误的,并没有找到文件?...任何帮助将不胜感激

4 个答案:

答案 0 :(得分:1)

x=["a","b","c"]
y = [x] * 4
# first print
print(y[0][0])

y[0][0] = "p"
# second print
print(y)

有关更多详细信息,您可以点击此链接 enter link description here

答案 1 :(得分:0)

问题是最后一个gradle版本与我怀疑的包不兼容。最后我不得不使用gradle 3,一切正常

答案 2 :(得分:0)

环境

React Native Navigation version: "2.0.2502"
React Native version: "0.56.0"
Platform(s) (iOS, Android, or both?): Android
Device info (Simulator/Device? OS version? Debug/Release?): Android Studio

我遵循了official documentation,然后遇到了同样的问题。在我的情况下,我将'RNN'文件夹移到了我的本机项目的node_modules中,然后Gradle工作了。

答案 3 :(得分:0)

您是否已安装Android SDK 27?在Android Studio中打开Android SDK Manager,并确保在那里安装该版本。另外,请尝试创建基于该版本的仿真器。