ekreutz / react-native-barcode-scanner-google

Barcode scanner for react native, which implements barcode detection from Google's Vision API.
MIT License
113 stars 68 forks source link

Could not resolve com.facebook.react:react-native:0.20.+. #43

Closed hladf closed 4 years ago

hladf commented 4 years ago

Hello @ekreutz When I try to generate apk, the error message says:

Could not resolve com.facebook.react:react-native:0.20.+. 
   Required by: project :app > project :react-native-barcode-scanner-google

Have any way to update the RN inside the package or other way to fix this?

hladf commented 4 years ago

Complete error message:

\android>gradlew assembleRelease

> Configure project :react-native-barcode-scanner-google
WARNING: Configuration 'compile' is obsolete and has been replaced with 'implementation' and 'api'.
It will be removed at the end of 2018. For more information see: http://d.android.com/r/tools/update-dependency-configurations.html
WARNING: The specified Android SDK Build Tools version (23.0.1) is ignored, as it is below the minimum supported version (28.0.3) for Android Gradle Plugin 3.4.2.
Android SDK Build Tools 28.0.3 will be used.
To suppress this warning, remove "buildToolsVersion '23.0.1'" from your build.gradle file, as each version of the Android Gradle Plugin now has a default version of the build tools.

FAILURE: Build failed with an exception.

* What went wrong:
Could not determine the dependencies of task ':app:compileReleaseJavaWithJavac'.
> Could not resolve all task dependencies for configuration ':app:releaseCompileClasspath'.
   > Could not resolve com.facebook.react:react-native:0.20.+.
     Required by:
         project :app > project :react-native-barcode-scanner-google
      > Failed to list versions for com.facebook.react:react-native.
         > Unable to load Maven meta-data from https://dl.google.com/dl/android/maven2/com/facebook/react/react-native/maven-metadata.xml.
            > Could not get resource 'https://dl.google.com/dl/android/maven2/com/facebook/react/react-native/maven-metadata.xml'.
               > Could not GET 'https://dl.google.com/dl/android/maven2/com/facebook/react/react-native/maven-metadata.xml'.
                  > dl.google.com

* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.

* Get more help at https://help.gradle.org

BUILD FAILED in 31s
hladf commented 4 years ago

FIXED: I'd edited these files to: \node_modules\react-native-barcode-scanner-google\android\build.gradle:

apply plugin: 'com.android.library'

android {
    compileSdkVersion 28
    buildToolsVersion "28.0.3"

    defaultConfig {
        minSdkVersion 16
        targetSdkVersion 28
        versionCode 1
        versionName "1.0"
    }
}

dependencies {
    compile 'com.google.android.gms:play-services-vision:8.4.0' // 8.1.0 or higher required
    compile 'com.facebook.react:react-native:0.61.1'
}

\node_modules\react-native-barcode-scanner-google\android\src\main\java\com\ekreutz\barcodescanner\BarcodeScannerPackage.java:

package com.ekreutz.barcodescanner;

import com.facebook.react.ReactPackage;
import com.facebook.react.bridge.JavaScriptModule;
import com.facebook.react.bridge.NativeModule;
import com.facebook.react.bridge.ReactApplicationContext;
import com.facebook.react.uimanager.ViewManager;

import java.util.Arrays;
import java.util.Collections;
import java.util.List;

public class BarcodeScannerPackage implements ReactPackage {

    private BarcodeScannerManager barcodeScannerManager;

    public BarcodeScannerPackage() {
        barcodeScannerManager = new BarcodeScannerManager();
    }

// commented the next line (@hladf Override) because showed an error during the 'assembleRelease'
    // @Override
    public List<Class<? extends JavaScriptModule>> createJSModules() {
        return Collections.emptyList();
    }