Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Could not find com.google.android.gms:play-services-gcm #13

Closed
jason-ong opened this issue Sep 26, 2017 · 8 comments

Comments

@jason-ong
Copy link

commented Sep 26, 2017

Hi,
I'm using pushwoosh-react-native-plugin 3.1.0 for android app.
But following error come up:

JS server already running.
Building and installing the app on the device (cd android && ./gradlew installDebug)...
Incremental java compilation is an incubating feature.
Observed package id '..;..;..;var;lib;android-sdk;samples;android-23' in inconsistent location '/usr/local/opt/android-sdk/samples/android-23' (Expected '/usr/local/opt/android-sdk/../../../var/lib/android-sdk/samples/android-23')
FAILURE: Build failed with an exception.
What went wrong:
A problem occurred configuring project ':app'.
Could not resolve all dependencies for configuration ':app:_debugApkCopy'.
Could not find com.google.android.gms:play-services-gcm:11.2.2.
Searched in the following locations:
file:/usr/local/opt/android-sdk/extras/google/m2repository/com/google/android/gms/play-services-gcm/11.2.2/play-services-gcm-11.2.2.pom
file:/usr/local/opt/android-sdk/extras/google/m2repository/com/google/android/gms/play-services-gcm/11.2.2/play-services-gcm-11.2.2.jar
file:/Users/jasonong/dev/react-native/SAM/android/sdk-manager/com/google/android/gms/play-services-gcm/11.2.2/play-services-gcm-11.2.2.jar
file:/usr/local/opt/android-sdk/extras/android/m2repository/com/google/android/gms/play-services-gcm/11.2.2/play-services-gcm-11.2.2.pom
file:/usr/local/opt/android-sdk/extras/android/m2repository/com/google/android/gms/play-services-gcm/11.2.2/play-services-gcm-11.2.2.jar
file:/Users/jasonong/dev/react-native/SAM/android/sdk-manager/com/google/android/gms/play-services-gcm/11.2.2/play-services-gcm-11.2.2.jar
Required by:
`
My android sdk have installed lastest android support repository & google repository.

For previous version 3.0.2, it working well,
but I need the "pushReceived" function to handling foreground notification.
Please help me to solve this issue together.

Environment:
OS: macOS Sierra 10.12.6
Node: 7.2.1
Yarn: Not Found
npm: 4.6.1
Watchman: 4.4.0
Xcode: Xcode 9.0 Build version 9A235
Android Studio: 2.1 AI-143.2821654

Packages: (wanted => installed)
react: ^16.0.0-alpha.12 => 16.0.0
react-native: ^0.48.3 => 0.48.4

@adylevy

This comment has been minimized.

Copy link

commented Sep 26, 2017

Try to look at:
https://stackoverflow.com/questions/45696551/failed-to-resolve-com-google-firebasefirebase-core11-2-0

basically:
need to add maven { url 'https://maven.google.com' } to allProjects in your root gradle

@jason-ong

This comment has been minimized.

Copy link
Author

commented Sep 27, 2017

@adylevy thanks, please let me ask another question here.

Currently, I am facing another issue.
I have search this issue on stackoverflow,
but don't have a solution for it.

Executing task ':app:processDebugResources' (up-to-date check took 0.021 secs) due to:
Value of input property 'buildToolsVersion' has changed for task ':app:processDebugResources'
All input files are considered out-of-date for incremental task ':app:processDebugResources'.
Starting process 'command '/usr/local/opt/android-sdk/build-tools/23.0.1/aapt''. Working directory: /Users/jasonong/dev/react-native/SAM/android/app Command: /usr/local/opt/android-sdk/build-tools/23.0.1/aapt package -f --no-crunch -I /usr/local/opt/android-sdk/platforms/android-23/android.jar -M /Users/jasonong/dev/react-native/SAM/android/app/build/intermediates/manifests/full/debug/AndroidManifest.xml -S /Users/jasonong/dev/react-native/SAM/android/app/build/intermediates/res/merged/debug -m -J /Users/jasonong/dev/react-native/SAM/android/app/build/generated/source/r/debug -F /Users/jasonong/dev/react-native/SAM/android/app/build/intermediates/res/resources-debug.ap_ --debug-mode --custom-package com.sam -0 apk --output-text-symbols /Users/jasonong/dev/react-native/SAM/android/app/build/intermediates/symbols/debug --no-version-vectors
Successfully started process 'command '/usr/local/opt/android-sdk/build-tools/23.0.1/aapt''
/Users/jasonong/dev/react-native/SAM/android/app/build/intermediates/res/merged/debug/values-v24/values-v24.xml:3: AAPT: Error retrieving parent for item: No resource found that matches the given name 'android:TextAppearance.Material.Widget.Button.Borderless.Colored'.
/Users/jasonong/dev/react-native/SAM/android/app/build/intermediates/res/merged/debug/values-v24/values-v24.xml:4: AAPT: Error retrieving parent for item: No resource found that matches the given name 'android:TextAppearance.Material.Widget.Button.Colored'.
/Users/jasonong/dev/react-native/SAM/android/app/build/intermediates/res/merged/debug/values-v24/values-v24.xml:3: error: Error retrieving parent for item: No resource found that matches the given name 'android:TextAppearance.Material.Widget.Button.Borderless.Colored'.
/Users/jasonong/dev/react-native/SAM/android/app/build/intermediates/res/merged/debug/values-v24/values-v24.xml:4: error: Error retrieving parent for item: No resource found that matches the given name 'android:TextAppearance.Material.Widget.Button.Colored'.
:app:processDebugResources FAILED
:app:processDebugResources (Thread[Daemon worker Thread 21,5,main]) completed. Took 0.884 secs.
FAILURE: Build failed with an exception.

My project compile sdk:
compileSdkVersion 23
buildToolsVersion "23.0.1"
compile "com.android.support:appcompat-v7:23.0.1"

I have try with this solution:
oblador/react-native-keychain#68 (comment)
It able to build successfully,
but unable to start up app due to pushwoosh plugin error below:

09-27 13:04:02.602: E/AndroidRuntime(19435): Process: com.innoractive.sam.debug, PID: 19435
09-27 13:04:02.602: E/AndroidRuntime(19435): java.lang.RuntimeException: Unable to get provider com.pushwoosh.PushwooshInitProvider: java.lang.IllegalStateException: You must include the following maven repository URL in project build.gradle:
09-27 13:04:02.602: E/AndroidRuntime(19435): allprojects {
09-27 13:04:02.602: E/AndroidRuntime(19435): repositories {
09-27 13:04:02.602: E/AndroidRuntime(19435): jcenter ()
09-27 13:04:02.602: E/AndroidRuntime(19435): maven {
09-27 13:04:02.602: E/AndroidRuntime(19435): url "https://maven.google.com"
09-27 13:04:02.602: E/AndroidRuntime(19435): }
09-27 13:04:02.602: E/AndroidRuntime(19435): }
09-27 13:04:02.602: E/AndroidRuntime(19435): }
09-27 13:04:02.602: E/AndroidRuntime(19435): Also all support libraries must be at least v26.0.1. For more info look at https://github.com/Pushwoosh/pushwoosh-android-sdk/blob/master/README.md
09-27 13:04:02.602: E/AndroidRuntime(19435): at android.app.ActivityThread.installProvider(ActivityThread.java:6206)

I already include maven.google.com in root gradle file.

allprojects {
repositories {
// Add jitpack repository (added by react-native-spinkit)
maven { url "https://jitpack.io" }
maven { url "https://maven.google.com" }
mavenLocal()
jcenter()
maven {
// All of React Native (JS, Obj-C sources, Android binaries) is installed from npm
url "$rootDir/../node_modules/react-native/android"
}
}
}

@shaders

This comment has been minimized.

Copy link

commented Sep 27, 2017

Hi,

Please note as per error displayed: Also all support libraries must be at least v26.0.1
Your libraries are v23:
compile "com.android.support:appcompat-v7:23.0.1"

@wfhm

This comment has been minimized.

Copy link
Member

commented Sep 27, 2017

@jason-ong

Please also note that CompileSdkVersion 26 and buildToolsVersion 26 are required for the latest plugin version.

The updated documentation can be found here:

http://docs.pushwoosh.com/docs/react-native-plugin

@jason-ong

This comment has been minimized.

Copy link
Author

commented Sep 27, 2017

@shaders @wfhm
Thanks for guidance.
Have another question,
update react native project sdk & library to 26,
will impact anything?

I have updated sdk & library to 26,
everything working fine.

@jason-ong jason-ong closed this Sep 27, 2017

@shaders

This comment has been minimized.

Copy link

commented Sep 27, 2017

@jason-ong everything should be fine

@urfusion

This comment has been minimized.

Copy link

commented Jul 17, 2019

Hi, I am still getting the same issue.
image

Here is my 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"

/**
 * 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 = true

android {
    compileSdkVersion rootProject.ext.compileSdkVersion

    compileOptions {
        sourceCompatibility JavaVersion.VERSION_1_8
        targetCompatibility JavaVersion.VERSION_1_8
    }

    defaultConfig {
        applicationId "com.merchant_app"
        minSdkVersion rootProject.ext.minSdkVersion
        targetSdkVersion rootProject.ext.targetSdkVersion
        versionCode 4
        versionName "1.2"
        missingDimensionStrategy 'react-native-camera', 'general' 
    }

    signingConfigs {
        release {
            if (project.hasProperty('MYAPP_RELEASE_STORE_FILE')) {
                storeFile file(MYAPP_RELEASE_STORE_FILE)
                storePassword MYAPP_RELEASE_STORE_PASSWORD
                keyAlias MYAPP_RELEASE_KEY_ALIAS

                keyPassword MYAPP_RELEASE_KEY_PASSWORD
            }
        }
    }
    splits {
        abi {
            reset()
            enable enableSeparateBuildPerCPUArchitecture
            universalApk false  // If true, also generate a universal APK
            include "armeabi-v7a", "x86", "arm64-v8a", "x86_64"
        }
    }
    buildTypes {
        release {
            minifyEnabled enableProguardInReleaseBuilds
            proguardFiles getDefaultProguardFile("proguard-android.txt"), "proguard-rules.pro"
            signingConfig signingConfigs.release
        }
    }
    // 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, "arm64-v8a": 3, "x86_64": 4]
            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
            }
        }
    }

    packagingOptions {
       pickFirst '**/libjsc.so'
       pickFirst '**/libc++_shared.so'
    // pickFirst 'lib/x86/libc++_shared.so'
    // pickFirst 'lib/arm64-v8a/libc++_shared.so'
    // pickFirst 'lib/x86_64/libc++_shared.so'
    // pickFirst 'lib/armeabi-v7a/libc++_shared.so'
  }
}

//  repositories {
//             maven {
//               url  "http://dl.bintray.com/lukaville/maven"
//             }
//     //    maven { url "https://maven.google.com" }
//     }

dependencies {
    
       compile (project(':react-native-camera')) {
        exclude group: "com.google.android.gms"
    }
    compile ("com.google.android.gms:play-services-vision:10.2.0") {
        force = true;
    }
    implementation project(':@react-native-community_netinfo')
    implementation project(':react-native-baidumap-sdk')
    implementation project(':react-native-geolocation-service')
    implementation project(':@react-native-community_async-storage')
    implementation project(':react-native-maps')
    implementation project(':react-native-webview')
    implementation project(':react-native-pdf')
    implementation project(':rn-fetch-blob')
    implementation project(':react-native-document-picker')
    implementation project(':react-native-image-picker')
    implementation project(':react-native-gesture-handler')
    implementation project(':react-native-vector-icons')
    implementation fileTree(dir: "libs", include: ["*.jar"])
    implementation "com.android.support:appcompat-v7:${rootProject.ext.supportLibVersion}"
    implementation "com.facebook.react:react-native:+"  // From node_modules'

    implementation "com.android.support:design:${rootProject.ext.supportLibVersion}"
}

// 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'
}

and build.gradle

// Top-level build file where you can add configuration options common to all sub-projects/modules.

buildscript {
    ext {
        buildToolsVersion = "28.0.3"
        minSdkVersion = 16
        compileSdkVersion = 28
        targetSdkVersion = 28
        supportLibVersion = "28.0.0"
        googlePlayServicesVersion = "16.0.0" // or set latest version
         androidMapsUtilsVersion = "0.5+"
         ext.kotlin_version = '1.3.21'
    }
    repositories {
        google()
        jcenter()
    }
    dependencies {
        classpath 'com.android.tools.build:gradle:3.3.1'
        // classpath 'org.jetbrains.kotlin:kotlin-gradle-plugin:1.2.41'
        // classpath 'com.android.tools.build:gradle:3.4.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"
        }
        maven { url "https://jitpack.io" }
        maven {
            url 'https://maven.google.com/'
            name 'Google'
        }
    }
}

subprojects {
    afterEvaluate {project ->
        if (project.hasProperty("android")) {
            android {
                compileSdkVersion 28
                buildToolsVersion "28.0.3"
            }
        }
    }
}

@wfhm

This comment has been minimized.

Copy link
Member

commented Jul 18, 2019

@urfusion

Pushwoosh React Native plugin does not use Play Services libraries starting with 5.13.0 version. You can find the list of the plugin's dependencies here.

Did you try adding 16.0.0 version of play-services-vision to your project as per the error message? Right now you are adding 10.2.0 which is quite outdated:

dependencies {
    
       compile (project(':react-native-camera')) {
        exclude group: "com.google.android.gms"
    }
    compile ("com.google.android.gms:play-services-vision:10.2.0") {
        force = true;
    }
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
5 participants
You can’t perform that action at this time.