Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/reactjs/21.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
我能';t使用react本机图像裁剪选择器构建android应用程序_Android_Reactjs_React Native - Fatal编程技术网

我能';t使用react本机图像裁剪选择器构建android应用程序

我能';t使用react本机图像裁剪选择器构建android应用程序,android,reactjs,react-native,Android,Reactjs,React Native,我想添加多个图像上传功能,所以我将react native image crop picker库安装到我的项目中,并在此处的自述中完成了步骤 但当我试图建立一个项目 react原生运行android 我犯了一个错误 FAILURE: Build failed with an exception. * What went wrong: Could not determine the dependencies of task ':app:preDebugBuild'. > Could not

我想添加多个图像上传功能,所以我将react native image crop picker库安装到我的项目中,并在此处的自述中完成了步骤

但当我试图建立一个项目

react原生运行android

我犯了一个错误

FAILURE: Build failed with an exception.

* What went wrong:
Could not determine the dependencies of task ':app:preDebugBuild'.
> Could not resolve all task dependencies for configuration ':app:debugRuntimeClasspath'.
   > Could not find com.github.yalantis:ucrop:2.2.2-native.
     Searched in the following locations:
       - file:/C:/Users/mmtbo/.m2/repository/com/github/yalantis/ucrop/2.2.2-native/ucrop-2.2.2-native.pom
       - file:/C:/Users/mmtbo/.m2/repository/com/github/yalantis/ucrop/2.2.2-native/ucrop-2.2.2-native.jar
       - file:/C:/Users/mmtbo/workspace/imagePickertest/node_modules/react-native/android/com/github/yalantis/ucrop/2.2.2-native/ucrop-2.2.2-native.pom
       - file:/C:/Users/mmtbo/workspace/imagePickertest/node_modules/react-native/android/com/github/yalantis/ucrop/2.2.2-native/ucrop-2.2.2-native.jar
       - file:/C:/Users/mmtbo/workspace/imagePickertest/node_modules/jsc-android/dist/com/github/yalantis/ucrop/2.2.2-native/ucrop-2.2.2-native.pom
       - file:/C:/Users/mmtbo/workspace/imagePickertest/node_modules/jsc-android/dist/com/github/yalantis/ucrop/2.2.2-native/ucrop-2.2.2-native.jar
       - https://dl.google.com/dl/android/maven2/com/github/yalantis/ucrop/2.2.2-native/ucrop-2.2.2-native.pom
       - https://dl.google.com/dl/android/maven2/com/github/yalantis/ucrop/2.2.2-native/ucrop-2.2.2-native.jar
       - https://jcenter.bintray.com/com/github/yalantis/ucrop/2.2.2-native/ucrop-2.2.2-native.pom
       - https://jcenter.bintray.com/com/github/yalantis/ucrop/2.2.2-native/ucrop-2.2.2-native.jar
     Required by:
         project :app > project :react-native-image-crop-picker
我找不到关于这个错误的太多东西

这是来自android/build.gradle的

    ext {
        buildToolsVersion = "28.0.3"
        minSdkVersion = 16
        compileSdkVersion = 28
        targetSdkVersion = 28
        supportLibVersion = "28.0.0"
    }
    repositories {
        google()
        mavenLocal()
        jcenter()
        maven { url "$rootDir/../node_modules/react-native/android" }

        // ADD THIS
        maven { url 'https://maven.google.com' }

        // ADD THIS
        maven { url "https://jitpack.io" }
    }
    dependencies {
        classpath("com.android.tools.build:gradle:3.4.1")

        // NOTE: Do not place your application dependencies here; they belong
        // in the individual module build.gradle files
    }
}
android {
    compileSdkVersion rootProject.ext.compileSdkVersion

    compileOptions {
        sourceCompatibility JavaVersion.VERSION_1_8
        targetCompatibility JavaVersion.VERSION_1_8
    }

    defaultConfig {
        applicationId "com.imagepickertest"
        minSdkVersion rootProject.ext.minSdkVersion
        targetSdkVersion rootProject.ext.targetSdkVersion
        versionCode 1
        versionName "1.0"
        vectorDrawables.useSupportLibrary = true
    }
android/app/build.gradle

    ext {
        buildToolsVersion = "28.0.3"
        minSdkVersion = 16
        compileSdkVersion = 28
        targetSdkVersion = 28
        supportLibVersion = "28.0.0"
    }
    repositories {
        google()
        mavenLocal()
        jcenter()
        maven { url "$rootDir/../node_modules/react-native/android" }

        // ADD THIS
        maven { url 'https://maven.google.com' }

        // ADD THIS
        maven { url "https://jitpack.io" }
    }
    dependencies {
        classpath("com.android.tools.build:gradle:3.4.1")

        // NOTE: Do not place your application dependencies here; they belong
        // in the individual module build.gradle files
    }
}
android {
    compileSdkVersion rootProject.ext.compileSdkVersion

    compileOptions {
        sourceCompatibility JavaVersion.VERSION_1_8
        targetCompatibility JavaVersion.VERSION_1_8
    }

    defaultConfig {
        applicationId "com.imagepickertest"
        minSdkVersion rootProject.ext.minSdkVersion
        targetSdkVersion rootProject.ext.targetSdkVersion
        versionCode 1
        versionName "1.0"
        vectorDrawables.useSupportLibrary = true
    }

您忘了遵循安装后的
步骤

您必须将jitpack.io添加到存储库中


下面是链接:

您应该非常重要地在android/build.gradle文件中添加以下行

maven { url "https://jitpack.io" }
因此,您的android/build.gradle文件应该如下所示

allprojects {
    repositories {
        .......                 //if there are any other modules
        maven { url "https://jitpack.io" }
    }
}
另请参见文档中的post步骤,并按照步骤进行操作


我也有同样的问题,可能是最新版本
0.35.0
的问题

通过降级到版本
0.34.1
解决了此问题

编辑: 我找到了这个问题的真正解决办法

您应该升级gradle:
com.android.tools.build:gradle:4.0.1


将库版本更改为2.2.3/更新安装后制作的模块
步骤。除了它们之外,我还应该添加其他内容吗。