Pushwoosh / pushwoosh-react-native-plugin

Other
58 stars 44 forks source link

google-services.json is missing #61

Closed vadimshvetsov closed 5 years ago

vadimshvetsov commented 5 years ago

After upgrading pushwoosh-react-native-plugin from 5.6.2 to 5.14.0 I've got an error when I'm running debug build script:

react-native run-android --variant=debug --appIdSuffix 'debug'
> Task :app:processDebugGoogleServices FAILED

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':app:processDebugGoogleServices'.
> File google-services.json is missing. The Google Services Plugin cannot function without it.

I haven't google-services.json file in my project because I'm not using google services and I want to avoid adding it to the project.

Environment: react-native: 0.59.1 buildToolsVersion = "28.0.3" minSdkVersion = 21 compileSdkVersion = 28 targetSdkVersion = 28 supportLibVersion = "28.0.0" classpath 'com.android.tools.build:gradle:3.3.1' classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:1.3.0" Emulator: Pixel

vadimshvetsov commented 5 years ago

Anyway even with adding google-services.json when I try to build app for Detox testing I've got:

> Task :pushwoosh-react-native-plugin:compileDebugAndroidTestJavaWithJavac FAILED
/Users/user/Development/Company/app/node_modules/pushwoosh-react-native-plugin/src/android/src/androidTest/java/com/pushwoosh/reactnativeplugin/ApplicationTest.java:4: error: package android.test does not exist
import android.test.ApplicationTestCase;
                   ^
/Users/user/Development/Company/app/node_modules/pushwoosh-react-native-plugin/src/android/src/androidTest/java/com/pushwoosh/reactnativeplugin/ApplicationTest.java:9: error: cannot find symbol
public class ApplicationTest extends ApplicationTestCase<Application> {
                                     ^
  symbol: class ApplicationTestCase
2 errors

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':pushwoosh-react-native-plugin:compileDebugAndroidTestJavaWithJavac'.
> Compilation failed; see the compiler error output for details.

Building command:

cd android && ./gradlew assembleDebug assembleAndroidTest -DtestBuildType=debug && cd ..

But everything building proper if I omit building test app

cd android && ./gradlew assembleDebug && cd ..

My app/build.gradle looks like below with test implementations according to Detox docs:

android {
    ...
    defaultConfig {
        ...
        // Detox settings
        testBuildType System.getProperty('testBuildType', 'debug')
        testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
    }
    ...
}
dependencies {
    ...
    implementation project(':pushwoosh-react-native-plugin')
    ...
    // Detox settings
    androidTestImplementation 'junit:junit:4.12'
    androidTestImplementation('com.wix:detox:+') { transitive = true }
}
wfhm commented 5 years ago

Hi @vadimshvetsov ,

Checking it.

wfhm commented 5 years ago

@vadimshvetsov

Adding the following lines manually to build.gradle of pushwoosh-react-native-plugin worked for me:

    androidTestImplementation ('com.google.android:android-test:+'){
        exclude group: 'xpp3', module: 'xpp3'
    }

Please note that you might need to enable multidex support or switch to minSdkVersion 21

As for adding google-services.json, it is a strict requirement since 5.13.0 version - Google has shut down GCM, so all Pushwoosh plugins were migrated to FCM, and it cannot function without associating your app with Firebase.

vadimshvetsov commented 5 years ago

@wfhm thanks, I'll consider to add google-services.json