Android Question Firebase - Parse Error

Randori

Member
Licensed User
Longtime User
Parse Error: There is a problem parsing the package.

I am getting this when add the Firebase modifications to the manifest editor. I have read the other threads on this to no avail. This error occurs on the device and the app does not install using the debug B4A Bridge.
 

Randori

Member
Licensed User
Longtime User
'This code will be applied to the manifest file during compilation.
'You do not need to modify it in most cases.
'See this link for for more information: https://www.b4x.com/forum/showthread.php?p=78136
AddManifestText(
<uses-sdk android:minSdkVersion="5" android:targetSdkVersion="19"/>
<supports-screens android:largeScreens="true"
android:normalScreens="true"
android:smallScreens="true"
android:anyDensity="true"/>)
SetApplicationAttribute(android:icon, "@drawable/icon")
SetApplicationAttribute(android:label, "$LABEL$")
AddPermission(android.permission.WRITE_EXTERNAL_STORAGE)
'End of default text.
'************ Google Play Services Base ************
AddApplicationText(
<activity android:name="com.google.android.gms.common.api.GoogleApiActivity"
android:theme="@android:style/Theme.Translucent.NoTitleBar"
android:exported="false"/>
<meta-data
android:name="com.google.android.gms.version"
android:value="@Integer/google_play_services_version" />
)
'************ Google Play Services Base (end) ************

'************ Firebase Base ************
CreateResourceFromFile("google-services", "google-services.json")
AddPermission(android.permission.ACCESS_NETWORK_STATE)
AddPermission(android.permission.INTERNET)
AddPermission(android.permission.WAKE_LOCK)
AddPermission(com.google.android.c2dm.permission.RECEIVE)
AddPermission(${applicationId}.permission.C2D_MESSAGE)
AddManifestText( <permission android:name="${applicationId}.permission.C2D_MESSAGE"
androidrotectionLevel="signature" />)
AddApplicationText(
<receiver
android:name="com.google.android.gms.measurement.AppMeasurementReceiver"
android:enabled="true">
<intent-filter>
<action android:name="com.google.android.gms.measurement.UPLOAD"/>
</intent-filter>
</receiver>

<service
android:name="com.google.android.gms.measurement.AppMeasurementService"
android:enabled="true"
android:exported="false"/>
<provider
android:authorities="${applicationId}.firebaseinitprovider"
android:name="com.google.firebase.provider.FirebaseInitProvider"
android:exported="false"
android:initOrder="100" />
<receiver
android:name="com.google.android.gms.measurement.AppMeasurementReceiver"
android:enabled="true">
<intent-filter>
<action android:name="com.google.android.gms.measurement.UPLOAD"/>
</intent-filter>
</receiver>

<service
android:name="com.google.android.gms.measurement.AppMeasurementService"
android:enabled="true"
android:exported="false"/>
<receiver
android:name="com.google.firebase.iid.FirebaseInstanceIdReceiver"
android:exported="true"
androidermission="com.google.android.c2dm.permission.SEND" >
<intent-filter>
<action android:name="com.google.android.c2dm.intent.RECEIVE" />
<action android:name="com.google.android.c2dm.intent.REGISTRATION" />
<category android:name="${applicationId}" />
</intent-filter>
</receiver>
<receiver
android:name="com.google.firebase.iid.FirebaseInstanceIdInternalReceiver"
android:exported="false" />


<service
android:name="com.google.firebase.iid.FirebaseInstanceIdService"
android:exported="true">
<intent-filter androidriority="-500">
<action android:name="com.google.firebase.INSTANCE_ID_EVENT" />
</intent-filter>
</service>
)
'************ Firebase Base (end) ************
'************ Firebase Auth ************
AddApplicationText(
<activity android:name="com.google.android.gms.auth.api.signin.internal.SignInHubActivity"
android:theme="@android:style/Theme.Translucent.NoTitleBar"
android:excludeFromRecents="true"
android:exported="false" />

<service
android:name="com.google.android.gms.auth.api.signin.RevocationBoundService"
android:exported="true"
androidermission="com.google.android.gms.auth.api.signin.permission.REVOCATION_NOTIFICATION" />
)
'************ Firebase Auth (end) ************
 
Upvote 0

Randori

Member
Licensed User
Longtime User
Yes, the error only happens with the firebase snippets in the manifest. Specifically it happens with the firebase "base" snippet.
 
Upvote 0

Randori

Member
Licensed User
Longtime User
OK...so sorry for the long delay on getting back to this. I have attempted with USB debugging:

B4A version: 6.00
Parsing code. (0.03s)
Compiling code. (0.16s)
Compiling layouts code. (0.01s)
Organizing libraries. (0.00s)
Generating R file. (0.26s)
Compiling debugger engine code. (2.00s)
Compiling generated Java code. (2.13s)
Convert byte code - optimized dex. (3.08s)
Packaging files. (1.16s)
Copying libraries resources (0.02s)
Found 2 resource files.
Signing package file (debug key). (0.80s)
ZipAlign file. (0.07s)
Installing file to device. Error
[ 3%] /data/local/tmp/RepairShopMobile_RAPID_DEBUG.apk
[ 6%] /data/local/tmp/RepairShopMobile_RAPID_DEBUG.apk
[ 9%] /data/local/tmp/RepairShopMobile_RAPID_DEBUG.apk
[ 12%] /data/local/tmp/RepairShopMobile_RAPID_DEBUG.apk
[ 16%] /data/local/tmp/RepairShopMobile_RAPID_DEBUG.apk
[ 19%] /data/local/tmp/RepairShopMobile_RAPID_DEBUG.apk
[ 22%] /data/local/tmp/RepairShopMobile_RAPID_DEBUG.apk
[ 25%] /data/local/tmp/RepairShopMobile_RAPID_DEBUG.apk
[ 29%] /data/local/tmp/RepairShopMobile_RAPID_DEBUG.apk
[ 32%] /data/local/tmp/RepairShopMobile_RAPID_DEBUG.apk
[ 35%] /data/local/tmp/RepairShopMobile_RAPID_DEBUG.apk
[ 38%] /data/local/tmp/RepairShopMobile_RAPID_DEBUG.apk
[ 41%] /data/local/tmp/RepairShopMobile_RAPID_DEBUG.apk
[ 45%] /data/local/tmp/RepairShopMobile_RAPID_DEBUG.apk
[ 48%] /data/local/tmp/RepairShopMobile_RAPID_DEBUG.apk
[ 51%] /data/local/tmp/RepairShopMobile_RAPID_DEBUG.apk
[ 54%] /data/local/tmp/RepairShopMobile_RAPID_DEBUG.apk
[ 58%] /data/local/tmp/RepairShopMobile_RAPID_DEBUG.apk
[ 61%] /data/local/tmp/RepairShopMobile_RAPID_DEBUG.apk
[ 64%] /data/local/tmp/RepairShopMobile_RAPID_DEBUG.apk
[ 67%] /data/local/tmp/RepairShopMobile_RAPID_DEBUG.apk
[ 71%] /data/local/tmp/RepairShopMobile_RAPID_DEBUG.apk
[ 74%] /data/local/tmp/RepairShopMobile_RAPID_DEBUG.apk
[ 77%] /data/local/tmp/RepairShopMobile_RAPID_DEBUG.apk
[ 80%] /data/local/tmp/RepairShopMobile_RAPID_DEBUG.apk
[ 83%] /data/local/tmp/RepairShopMobile_RAPID_DEBUG.apk
[ 87%] /data/local/tmp/RepairShopMobile_RAPID_DEBUG.apk
[ 90%] /data/local/tmp/RepairShopMobile_RAPID_DEBUG.apk
[ 93%] /data/local/tmp/RepairShopMobile_RAPID_DEBUG.apk
[ 96%] /data/local/tmp/RepairShopMobile_RAPID_DEBUG.apk
[100%] /data/local/tmp/RepairShopMobile_RAPID_DEBUG.apk
pkg: /data/local/tmp/RepairShopMobile_RAPID_DEBUG.apk
Failure [INSTALL_PARSE_FAILED_MANIFEST_MALFORMED]
 
Upvote 0

Randori

Member
Licensed User
Longtime User
I believe I figured it out...the Package Name was not working with what I initially had (2 segmented name)...changed it to a 3 segment name and it worked.
 
Upvote 0

Smee

Well-Known Member
Licensed User
Longtime User
I have exactly the same error. If I take out the Base section then the program will install but it will not run. I am using the latest v of b4A and the latest Bridge. This is the error log after removing the snippet. I tried changing the name as per Randori but that gave me an error. Also I cannot find how to run debug in Legacy mode, has this been removed



Logger connected to: samsung GT-N7100
--------- beginning of /dev/log/main
*** Service (starter) Create ***
** Service (starter) Start **
** Activity (main) Create, isFirst = true **
** Activity (main) Resume **
*** Service (firebasemessaging) Create ***
Error occurred on line: 12 (FirebaseMessaging)
java.lang.IllegalStateException: Default FirebaseApp is not initialized in this process AnyFCsApp.QT. Make sure to call FirebaseApp.initializeApp(Context) first.
at com.google.firebase.FirebaseApp.getInstance(Unknown Source)
at com.google.firebase.iid.FirebaseInstanceId.getInstance(Unknown Source)
at com.google.firebase.messaging.FirebaseMessaging.getInstance(Unknown Source)
at anywheresoftware.b4a.objects.FirebaseNotificationsService$FirebaseMessageWrapper.Initialize(FirebaseNotificationsService.java:94)
at AnyFCsApp.QT.firebasemessaging._service_create(firebasemessaging.java:173)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:515)
at anywheresoftware.b4a.shell.Shell.runMethod(Shell.java:710)
at anywheresoftware.b4a.shell.Shell.raiseEventImpl(Shell.java:339)
at anywheresoftware.b4a.shell.Shell.raiseEvent(Shell.java:249)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:515)
at anywheresoftware.b4a.ShellBA.raiseEvent2(ShellBA.java:139)
at anywheresoftware.b4a.BA.raiseEvent(BA.java:166)
at AnyFCsApp.QT.firebasemessaging.onCreate(firebasemessaging.java:55)
at android.app.ActivityThread.handleCreateService(ActivityThread.java:2821)
at android.app.ActivityThread.access$1900(ActivityThread.java:175)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1390)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:146)
at android.app.ActivityThread.main(ActivityThread.java:5602)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:515)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1283)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1099)
at dalvik.system.NativeStart.main(Native Method)
** Service (firebasemessaging) Start **
*** Service (starter) Create ***
** Service (starter) Start **
** Activity (main) Create, isFirst = true **
** Activity (main) Resume **
*** Service (firebasemessaging) Create ***
Error occurred on line: 12 (FirebaseMessaging)
java.lang.IllegalStateException: Default FirebaseApp is not initialized in this process AnyFCsApp.QT. Make sure to call FirebaseApp.initializeApp(Context) first.
at com.google.firebase.FirebaseApp.getInstance(Unknown Source)
at com.google.firebase.iid.FirebaseInstanceId.getInstance(Unknown Source)
at com.google.firebase.messaging.FirebaseMessaging.getInstance(Unknown Source)
at anywheresoftware.b4a.objects.FirebaseNotificationsService$FirebaseMessageWrapper.Initialize(FirebaseNotificationsService.java:94)
at AnyFCsApp.QT.firebasemessaging._service_create(firebasemessaging.java:173)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:515)
at anywheresoftware.b4a.shell.Shell.runMethod(Shell.java:710)
at anywheresoftware.b4a.shell.Shell.raiseEventImpl(Shell.java:339)
at anywheresoftware.b4a.shell.Shell.raiseEvent(Shell.java:249)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:515)
at anywheresoftware.b4a.ShellBA.raiseEvent2(ShellBA.java:139)
at anywheresoftware.b4a.BA.raiseEvent(BA.java:166)
at AnyFCsApp.QT.firebasemessaging.onCreate(firebasemessaging.java:55)
at android.app.ActivityThread.handleCreateService(ActivityThread.java:2821)
at android.app.ActivityThread.access$1900(ActivityThread.java:175)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1390)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:146)
at android.app.ActivityThread.main(ActivityThread.java:5602)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:515)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1283)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1099)
at dalvik.system.NativeStart.main(Native Method)
** Service (firebasemessaging) Start **

This is the base snippet
'************ Firebase Base ************CreateResourceFromFile("google-services", "google-services.json")
AddPermission(android.permission.ACCESS_NETWORK_STATE)
AddPermission(android.permission.INTERNET)
AddPermission(android.permission.WAKE_LOCK)
AddPermission(com.google.android.c2dm.permission.RECEIVE)
AddPermission(${applicationId}.permission.C2D_MESSAGE)
AddManifestText( <permission android:name="${applicationId}.permission.C2D_MESSAGE"
androidrotectionLevel="signature" />)
AddApplicationText(
<receiver
android:name="com.google.android.gms.measurement.AppMeasurementReceiver"
android:enabled="true">
<intent-filter>
<action android:name="com.google.android.gms.measurement.UPLOAD"/>
</intent-filter>
</receiver>

<service
android:name="com.google.android.gms.measurement.AppMeasurementService"
android:enabled="true"
android:exported="false"/>
<provider
android:authorities="${applicationId}.firebaseinitprovider"
android:name="com.google.firebase.provider.FirebaseInitProvider"
android:exported="false"
android:initOrder="100" />
<receiver
android:name="com.google.android.gms.measurement.AppMeasurementReceiver"
android:enabled="true">
<intent-filter>
<action android:name="com.google.android.gms.measurement.UPLOAD"/>
</intent-filter>
</receiver>

<service
android:name="com.google.android.gms.measurement.AppMeasurementService"
android:enabled="true"
android:exported="false"/>
<receiver
android:name="com.google.firebase.iid.FirebaseInstanceIdReceiver"
android:exported="true"
androidermission="com.google.android.c2dm.permission.SEND" >
<intent-filter>
<action android:name="com.google.android.c2dm.intent.RECEIVE" />
<action android:name="com.google.android.c2dm.intent.REGISTRATION" />
<category android:name="${applicationId}" />
</intent-filter>
</receiver>
<receiver
android:name="com.google.firebase.iid.FirebaseInstanceIdInternalReceiver"
android:exported="false" />


<service
android:name="com.google.firebase.iid.FirebaseInstanceIdService"
android:exported="true">
<intent-filter androidriority="-500">
<action android:name="com.google.firebase.INSTANCE_ID_EVENT" />
</intent-filter>
</service>
)
'************ Firebase Base (end) ************
 
Upvote 0

Smee

Well-Known Member
Licensed User
Longtime User
I should add that the manifest code has just been copied and pasted from the firebase tutorial
 
Upvote 0

Smee

Well-Known Member
Licensed User
Longtime User
solved
I created a new app in Firebase with 3 names and then renamed my program, it then worked. This may well be worth noting in the firebase tutorials that the package name should have a 3 segment name
 
Upvote 0
Cookies are required to use this site. You must accept them to continue using the site. Learn more…