ibm-bluemix-mobile-services / bms-push-react-native

IBM Cloud Mobile Services - Client SDK React Native for Push service
Apache License 2.0
2 stars 2 forks source link

Android Compilation error/execution error #17

Open b-allard opened 4 years ago

b-allard commented 4 years ago

Hi,

I have integrated your librairie in the last version ("bmd-push-react-native": "^1.4.0") on Android (React-Native project). However when I change my manifest, some elements are not found, write in red :

`

    <service android:exported="true" android:name="com.ibm.mobilefirstplatform.clientsdk.android.push.api.MFPPushIntentService">
        <intent-filter>
            <action android:name="com.google.firebase.MESSAGING_EVENT"/>
        </intent-filter>
    </service>
    <service android:exported="true" android:name="com.ibm.mobilefirstplatform.clientsdk.android.push.api.MFPPush">
        <intent-filter>
            <action android:name="com.google.firebase.INSTANCE_ID_EVENT"/>
        </intent-filter>
    </service>`

Gradle didn't find MFPPushNotificationHandler, MFPPushIntentService and MFPPush.

I have try to sync, clean and rebuild, nothing changes.

I have try to launch the project, but the app crash and I have the following message in the Android console : Process:com.myapppackage, PID: 1590 java.lang.NoClassDefFoundError: Failed resolution of: Lcom/google/firebase/iid/FirebaseInstanceIdService; at com.bmdpush.react.RNBmdPushReactPackage.createNativeModules(RNBmdPushReactPackage.java:16) at com.facebook.react.ReactPackageHelper.getNativeModuleIterator(ReactPackageHelper.java:42) at com.facebook.react.NativeModuleRegistryBuilder.processPackage(NativeModuleRegistryBuilder.java:42) at com.facebook.react.ReactInstanceManager.processPackage(ReactInstanceManager.java:1298) at com.facebook.react.ReactInstanceManager.processPackages(ReactInstanceManager.java:1269) at com.facebook.react.ReactInstanceManager.createReactContext(ReactInstanceManager.java:1194) at com.facebook.react.ReactInstanceManager.access$1000(ReactInstanceManager.java:132) at com.facebook.react.ReactInstanceManager$5.run(ReactInstanceManager.java:996) at java.lang.Thread.run(Thread.java:919) Caused by: java.lang.ClassNotFoundException: Didn't find class "com.google.firebase.iid.FirebaseInstanceIdService" on path: DexPathList[[zip file "/data/app/com.myapppackage-386OxQUwvwu_aYpWqE-adQ==/base.apk"],nativeLibraryDirectories=[/data/app/com.myapppackage-386OxQUwvwu_aYpWqE-adQ==/lib/x86, /data/app/com.myapppackage-386OxQUwvwu_aYpWqE-adQ==/base.apk!/lib/x86, /system/lib, /system/product/lib]] at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:196) at java.lang.ClassLoader.loadClass(ClassLoader.java:379) at java.lang.ClassLoader.loadClass(ClassLoader.java:312) at com.bmdpush.react.RNBmdPushReactPackage.createNativeModules(RNBmdPushReactPackage.java:16)  at com.facebook.react.ReactPackageHelper.getNativeModuleIterator(ReactPackageHelper.java:42)  at com.facebook.react.NativeModuleRegistryBuilder.processPackage(NativeModuleRegistryBuilder.java:42)  at com.facebook.react.ReactInstanceManager.processPackage(ReactInstanceManager.java:1298)  at com.facebook.react.ReactInstanceManager.processPackages(ReactInstanceManager.java:1269)  at com.facebook.react.ReactInstanceManager.createReactContext(ReactInstanceManager.java:1194)  at com.facebook.react.ReactInstanceManager.access$1000(ReactInstanceManager.java:132)  at com.facebook.react.ReactInstanceManager$5.run(ReactInstanceManager.java:996)  at java.lang.Thread.run(Thread.java:919) 

Please could you help me ?

Thanks in advance,

Benjamin

AnanthaKrish commented 4 years ago

@b-allard Hi, Could you please show the gradle file ?

b-allard commented 4 years ago

Hi @AnanthaKrish, i have attached the project build.gradle and the app build.gradle (by adding .txt suffix to be uploaded directly on github)

app.build.gradle.txt project.build.gradle.txt

And the AndroidmManifest (idem with adding .txt suffix at the upload): AndroidManifest.xml.txt

AnanthaKrish commented 4 years ago

@b-allard In your project open the android -> app -> build.gradle file . Locate the dependencies{} section and add apply plugin: 'com.google.gms.google-services' . For reference use the below file, build.gradle.zip

b-allard commented 4 years ago

I have applied the modification at the app>build.gradle and now i have an other error :

java.lang.NoClassDefFoundError: Failed resolution of: Lcom/google/firebase/iid/FirebaseInstanceIdService; at com.bmdpush.react.RNBmdPushReactPackage.createNativeModules(RNBmdPushReactPackage.java:16) at com.facebook.react.ReactPackageHelper.getNativeModuleIterator(ReactPackageHelper.java:42) at com.facebook.react.NativeModuleRegistryBuilder.processPackage(NativeModuleRegistryBuilder.java:42) at com.facebook.react.ReactInstanceManager.processPackage(ReactInstanceManager.java:1298) at com.facebook.react.ReactInstanceManager.processPackages(ReactInstanceManager.java:1269) at com.facebook.react.ReactInstanceManager.createReactContext(ReactInstanceManager.java:1194) at com.facebook.react.ReactInstanceManager.access$1000(ReactInstanceManager.java:132) at com.facebook.react.ReactInstanceManager$5.run(ReactInstanceManager.java:996) at java.lang.Thread.run(Thread.java:919) Caused by: java.lang.ClassNotFoundException: Didn't find class "com.google.firebase.iid.FirebaseInstanceIdService" on path: DexPathList[[zip file "/data/app/com.-74AADXiwYGnzFV8A9mEMDQ==/base.apk"],nativeLibraryDirectories=[/data/app/com.myapppackage [android.zip](https://github.com/ibm-bluemix-mobile-services/bms-push-react-native/files/4786591/android.zip) -74AADXiwYGnzFV8A9mEMDQ==/lib/x86, /data/app/com.myapppackage-74AADXiwYGnzFV8A9mEMDQ==/base.apk!/lib/x86, /system/lib, /system/product/lib]] at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:196) at java.lang.ClassLoader.loadClass(ClassLoader.java:379) at java.lang.ClassLoader.loadClass(ClassLoader.java:312) at com.bmdpush.react.RNBmdPushReactPackage.createNativeModules(RNBmdPushReactPackage.java:16)  at com.facebook.react.ReactPackageHelper.getNativeModuleIterator(ReactPackageHelper.java:42)  at com.facebook.react.NativeModuleRegistryBuilder.processPackage(NativeModuleRegistryBuilder.java:42)  at com.facebook.react.ReactInstanceManager.processPackage(ReactInstanceManager.java:1298)  at com.facebook.react.ReactInstanceManager.processPackages(ReactInstanceManager.java:1269)  at com.facebook.react.ReactInstanceManager.createReactContext(ReactInstanceManager.java:1194)  at com.facebook.react.ReactInstanceManager.access$1000(ReactInstanceManager.java:132)  at com.facebook.react.ReactInstanceManager$5.run(ReactInstanceManager.java:996)  at java.lang.Thread.run(Thread.java:919) 

I have attached my gradles and manifest files: android.zip

AnanthaKrish commented 4 years ago

@b-allard Could you please create a customer ticket?