>

반작용 적 인 것에 익숙하지 않기 때문에 어리석은 실수를 저지른 것에 대해 실례합니다.

기본적으로 여기에 게시하기 전에 찾을 수있는 모든 것을 시도했지만 지금은 이것이 내 목적 (일명 바보)인지 아니면 최근 업데이트로 인한 버그인지 확실하지 않습니다.

그래서 내 문제는 위에서 언급 한 오류 메시지입니다 . react-native run-android 를 사용하여 앱을 빌드하려고 할 때 발생합니다.  또는 심지어 gradlew clean ). app/build.gradle, build.gradle 및 settings.gradle 파일뿐만 아니라 아래에 전체 오류 메시지를 게시합니다.

"react-native init"에 의해 생성 된 방식으로 모든 파일을 남겨두고 각 라이브러리의 설치 안내서에 따라 추가해야하는 명령을 "그냥"추가했습니다.

Firebase SDK의 최근 변경으로 인해 gradle 버전 등과 관련하여 상당히 변경해야했습니다.이 문제와 관련이 있는지 궁금합니다.!

아, 버전 번호 :

"dependencies": {
"babel-core": "^6.26.3",
"eslint": "^4.19.1",
"fbjs": "^0.8.16",
"react": "16.3.1",
"react-native": "0.55.4",
"react-native-firebase": "^4.1.0",
"react-native-navigation": "^1.1.458",
"react-native-vector-icons": "^4.6.0",
"react-redux": "^5.0.7",
"redux": "^4.0.0",
"redux-logger": "^3.0.6",
"redux-thunk": "^2.2.0"
}

원사 ( yarn add react-native-vector-icons )로 모든 패키지를 설치했습니다 등) 및 npm ( npm install ) npm install react-native-vector-icons 뿐만 아니라 , 등) 관련이 없는지 확인하십시오. 그 사이에서 물론 전체 node_modules 폴더를 제거했습니다. react-native link 도  도와주세요.

또한 언급 된 react-native-vector-icons 에 국한되지 않습니다  패키지 : 프로젝트에서 완전히 제거하고 다른 패키지에 대해 동일한 오류가 나타납니다.

도움과 힌트에 감사드립니다!

미리 감사합니다!

더스틴

오류 메시지 :

FAILURE: Build failed with an exception.
    * What went wrong:
    A problem occurred configuring project ':app'.
    > Could not resolve all dependencies for configuration ':app:debugCompileClasspath'.
       > More than one variant of project :react-native-vector-icons matches the consumer attributes:
           - Configuration ':react-native-vector-icons:debugApiElements' variant android-aidl:
               - Found artifactType 'android-aidl' but wasn't required.
               - Required com.android.build.api.attributes.BuildTypeAttr 'debug' and found compatible value 'debug'.
               - Found com.android.build.api.attributes.VariantAttr 'debug' but wasn't required.
               - Required com.android.build.gradle.internal.dependency.AndroidTypeAttr 'Aar' and found compatible value 'Aar'.
               - Required org.gradle.usage 'java-api' and found compatible value 'java-api'.
           - Configuration ':react-native-vector-icons:debugApiElements' variant android-classes:
               - Found artifactType 'android-classes' but wasn't required.
               - Required com.android.build.api.attributes.BuildTypeAttr 'debug' and found compatible value 'debug'.
               - Found com.android.build.api.attributes.VariantAttr 'debug' but wasn't required.
               - Required com.android.build.gradle.internal.dependency.AndroidTypeAttr 'Aar' and found compatible value 'Aar'.
               - Required org.gradle.usage 'java-api' and found compatible value 'java-api'.
           - Configuration ':react-native-vector-icons:debugApiElements' variant android-manifest:
               - Found artifactType 'android-manifest' but wasn't required.
               - Required com.android.build.api.attributes.BuildTypeAttr 'debug' and found compatible value 'debug'.
               - Found com.android.build.api.attributes.VariantAttr 'debug' but wasn't required.
               - Required com.android.build.gradle.internal.dependency.AndroidTypeAttr 'Aar' and found compatible value 'Aar'.
               - Required org.gradle.usage 'java-api' and found compatible value 'java-api'.
           - Configuration ':react-native-vector-icons:debugApiElements' variant android-renderscript:
               - Found artifactType 'android-renderscript' but wasn't required.
               - Required com.android.build.api.attributes.BuildTypeAttr 'debug' and found compatible value 'debug'.
               - Found com.android.build.api.attributes.VariantAttr 'debug' but wasn't required.
               - Required com.android.build.gradle.internal.dependency.AndroidTypeAttr 'Aar' and found compatible value 'Aar'.
               - Required org.gradle.usage 'java-api' and found compatible value 'java-api'.
           - Configuration ':react-native-vector-icons:debugApiElements' variant jar:
               - Found artifactType 'jar' but wasn't required.
               - Required com.android.build.api.attributes.BuildTypeAttr 'debug' and found compatible value 'debug'.
               - Found com.android.build.api.attributes.VariantAttr 'debug' but wasn't required.
               - Required com.android.build.gradle.internal.dependency.AndroidTypeAttr 'Aar' and found compatible value 'Aar'.
               - Required org.gradle.usage 'java-api' and found compatible value 'java-api'.

APP/BUILD.GRADLE :

apply plugin: "com.android.application"
import com.android.build.OutputFile
/**
 * The react.gradle file registers a task for each build variant (e.g. bundleDebugJsAndAssets
 * and bundleReleaseJsAndAssets).
 * These basically call `react-native bundle` with the correct arguments during the Android build
 * cycle. By default, bundleDebugJsAndAssets is skipped, as in debug/dev mode we prefer to load the
 * bundle directly from the development server. Below you can see all the possible configurations
 * and their defaults. If you decide to add a configuration block, make sure to add it before the
 * `apply from: "../../node_modules/react-native/react.gradle"` line.
 *
 * project.ext.react = [
 *   // the name of the generated asset file containing your JS bundle
 *   bundleAssetName: "index.android.bundle",
 *
 *   // the entry file for bundle generation
 *   entryFile: "index.android.js",
 *
 *   // whether to bundle JS and assets in debug mode
 *   bundleInDebug: false,
 *
 *   // whether to bundle JS and assets in release mode
 *   bundleInRelease: true,
 *
 *   // whether to bundle JS and assets in another build variant (if configured).
 *   // See http://tools.android.com/tech-docs/new-build-system/user-guide#TOC-Build-Variants
 *   // The configuration property can be in the following formats
 *   //         'bundleIn${productFlavor}${buildType}'
 *   //         'bundleIn${buildType}'
 *   // bundleInFreeDebug: true,
 *   // bundleInPaidRelease: true,
 *   // bundleInBeta: true,
 *
 *   // whether to disable dev mode in custom build variants (by default only disabled in release)
 *   // for example: to disable dev mode in the staging build type (if configured)
 *   devDisabledInStaging: true,
 *   // The configuration property can be in the following formats
 *   //         'devDisabledIn${productFlavor}${buildType}'
 *   //         'devDisabledIn${buildType}'
 *
 *   // the root of your project, i.e. where "package.json" lives
 *   root: "../../",
 *
 *   // where to put the JS bundle asset in debug mode
 *   jsBundleDirDebug: "$buildDir/intermediates/assets/debug",
 *
 *   // where to put the JS bundle asset in release mode
 *   jsBundleDirRelease: "$buildDir/intermediates/assets/release",
 *
 *   // where to put drawable resources / React Native assets, e.g. the ones you use via
 *   // require('./image.png')), in debug mode
 *   resourcesDirDebug: "$buildDir/intermediates/res/merged/debug",
 *
 *   // where to put drawable resources / React Native assets, e.g. the ones you use via
 *   // require('./image.png')), in release mode
 *   resourcesDirRelease: "$buildDir/intermediates/res/merged/release",
 *
 *   // by default the gradle tasks are skipped if none of the JS files or assets change; this means
 *   // that we don't look at files in android/ or ios/ to determine whether the tasks are up to
 *   // date; if you have any other folders that you want to ignore for performance reasons (gradle
 *   // indexes the entire tree), add them here. Alternatively, if you have JS files in android/
 *   // for example, you might want to remove it from here.
 *   inputExcludes: ["android/**", "ios/**"],
 *
 *   // override which node gets called and with what additional arguments
 *   nodeExecutableAndArgs: ["node"],
 *
 *   // supply additional arguments to the packager
 *   extraPackagerArgs: []
 * ]
 */
project.ext.react = [
    entryFile: "index.js"
]
apply from: "../../node_modules/react-native/react.gradle"
apply from: "../../node_modules/react-native-vector-icons/fonts.gradle"
/**
 * Set this to true to create two separate APKs instead of one:
 *   - An APK that only works on ARM devices
 *   - An APK that only works on x86 devices
 * The advantage is the size of the APK is reduced by about 4MB.
 * Upload all the APKs to the Play Store and people will download
 * the correct one based on the CPU architecture of their device.
 */
def enableSeparateBuildPerCPUArchitecture = false
/**
 * Run Proguard to shrink the Java bytecode in release builds.
 */
def enableProguardInReleaseBuilds = false
android {
    compileSdkVersion 25
    buildToolsVersion "25.0.1"
    defaultConfig {
        applicationId "com.seroleashed.budgetmanager"
        minSdkVersion 19
        targetSdkVersion 25
        versionCode 1
        versionName "1.0"
        ndk {
            abiFilters "armeabi-v7a", "x86"
        }
    }
    splits {
        abi {
            reset()
            enable enableSeparateBuildPerCPUArchitecture
            universalApk false  // If true, also generate a universal APK
            include "armeabi-v7a", "x86"
        }
    }
    buildTypes {
        release {
            minifyEnabled enableProguardInReleaseBuilds
            proguardFiles getDefaultProguardFile("proguard-android.txt"), "proguard-rules.pro"
        }
    }
    // applicationVariants are e.g. debug, release
    applicationVariants.all { variant ->
        variant.outputs.each { output ->
            // For each separate APK per architecture, set a unique version code as described here:
            // http://tools.android.com/tech-docs/new-build-system/user-guide/apk-splits
            def versionCodes = ["armeabi-v7a":1, "x86":2]
            def abi = output.getFilter(OutputFile.ABI)
            if (abi != null) {  // null for the universal-debug, universal-release variants
                output.versionCodeOverride =
                        versionCodes.get(abi) * 1048576 + defaultConfig.versionCode
            }
        }
    }
}
dependencies {
    compile project(':react-native-vector-icons')
    compile project(':react-native-navigation')
    compile(project(':react-native-firebase')) {
        transitive = false
    }
    implementation fileTree(dir: "libs", include: ["*.jar"])
    implementation project(':react-native-vector-icons')
    implementation project(':react-native-navigation')
    implementation "com.android.support:appcompat-v7:27.0.1"
    implementation "com.facebook.react:react-native:+"  // From node_modules
    implementation project(':react-native-firebase')
    // RNFirebase required dependencies
    implementation "com.google.android.gms:play-services-base:15.0.0"
    implementation "com.google.firebase:firebase-core:15.0.2"
    implementation "com.google.firebase:firebase-auth:15.1.0"
    implementation "com.google.firebase:firebase-database:15.0.0"
    implementation "com.google.firebase:firebase-messaging:15.0.2"
}
// Run this once to be able to run the application with BUCK
// puts all compile dependencies into folder libs for BUCK to use
task copyDownloadableDepsToLibs(type: Copy) {
    from configurations.compile
    into 'libs'
}
apply plugin: 'com.google.gms.google-services'

BUILD.GRADLE :

// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
    repositories {
        jcenter()
        google()
    }
    dependencies {
        classpath 'com.android.tools.build:gradle:3.1.2'
        classpath 'com.google.gms:google-services:3.3.0'
        // NOTE: Do not place your application dependencies here; they belong
        // in the individual module build.gradle files
    }
}
allprojects {
    repositories {
        mavenLocal()
        jcenter()
        maven {
            // All of React Native (JS, Obj-C sources, Android binaries) is installed from npm
            url "$rootDir/../node_modules/react-native/android"
        }
        google()
    }
}

SETTINGS.GRADLE :

rootProject.name = 'BudgetManager'
include ':app'
include ':react-native-vector-icons'
project(':react-native-vector-icons').projectDir = new File(rootProject.projectDir, '../node_modules/react-native-vector-icons/android')
include ':react-native-navigation'
project(':react-native-navigation').projectDir = new File(rootProject.projectDir, '../node_modules/react-native-navigation/android/app')
include ':react-native-firebase'
project(':react-native-firebase').projectDir = new File(rootProject.projectDir, '../node_modules/react-native-firebase/android')
include ':react-native-vector-icons'
project(':react-native-vector-icons').projectDir = new File(rootProject.projectDir, '../node_modules/react-native-vector-icons/android')
include ':react-native-navigation'
project(':react-native-navigation').projectDir = new File(rootProject.projectDir, '../node_modules/react-native

  • 답변 # 1

    와이즈 비즈 이동  맨 처음에는 이와 같은 문제를 해결할 수 있습니다. 코드에서 수정 한 예

    google()
    
    

  • 답변 # 2

    프로젝트의 루트 폴더에서 다음 명령을 실행할 수 있습니다

    buildscript {
        google()
        repositories {
            jcenter()
        }
        dependencies {
            classpath 'com.android.tools.build:gradle:3.1.2'
            classpath 'com.google.gms:google-services:3.3.0'
            // NOTE: Do not place your application dependencies here; they belong
            // in the individual module build.gradle files
        }
    }
    allprojects {
        repositories {
            google()
            mavenLocal()
            jcenter()
            maven {
                url "$rootDir/../node_modules/react-native/android"
            }  
        }
    }
    
    

  • 답변 # 3

    @Prahbu로 시작했지만 중간에 변경되어 다른 답변으로 게시 한 내용을 게시 할 것이라고 생각했습니다.

    여기서 내가 한 일이 (프로젝트의 루트 폴더에서도) :

    classpath 'com.google.gms:google-services:3.2.1'
    
    

    결국이 오류가 발생합니다. 이 경우 1. You need to delete both ios,android and node module folder. Afterwards, you can run the following commands 2. > npm install //to get the node module folder 3. > react-native-git-upgrade 를 삭제하십시오.  (내용을 저장 한 후) 예를 들어 이름을 .babelrc2로 바꾸고 생성 된 .babelrc 를 바꿀 수 있습니다.  완료되면 당신과 함께.

    react-native-git-upgrade가 ios 및 android 폴더를 생성하지 않은 경우

    .babelrc
    
    

    그리고 남은 것은 원래 답변에 따라

    react-native eject
    
    

    4. > react-native link // for linking the libraries 5. > react-native run android/ios

관련 자료

  • 이전 reactjs - REST 데이터에 대한 KendoUI 리 액트 그리드 예제 찾기
  • 다음 GDB에서 중첩 함수 호출을 단계별로 수행하려면 어떻게해야합니까?