Android Question java.lang.ClassNotFoundException: Didn't find class "com.google.android.gms.common.api.GoogleApiActivity"

Filippo

Expert
Licensed User
Longtime User
Hi,

in my app I don't use ads, yet I get crash reports like this, how can it be?
How can I prevent such crashes?

Ereigniszusammenfassung 4.75 (91) 8.1.0Nexus 5X 13.09.2022, 22:02:57

Fatal Exception: java.lang.RuntimeException: Unable to instantiate activity ComponentInfo{fg.speedpilot_lite/com.google.android.gms.common.api.GoogleApiActivity}: java.lang.ClassNotFoundException: Didn't find class "com.google.android.gms.common.api.GoogleApiActivity" on path: DexPathList[[zip file "/data/app/fg.speedpilot_lite-A0CNeWQK601t6ubgIIAgXg==/base.apk"],nativeLibraryDirectories=[/data/app/fg.speedpilot_lite-A0CNeWQK601t6ubgIIAgXg==/lib/x86, /system/lib, /vendor/lib]]
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2679)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2856)
at android.app.ActivityThread.-wrap11()
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1589)
at android.os.Handler.dispatchMessage(Handler.java:106)
at android.os.Looper.loop(Looper.java:164)
at android.app.ActivityThread.main(ActivityThread.java:6494)
at java.lang.reflect.Method.invoke(Method.java)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:438)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:807)

App-Manifest:
AddManifestText(
<uses-sdk android:minSdkVersion="21" android:targetSdkVersion="30"/>
<uses-feature android:name="android.hardware.location.gps"/>
<supports-screens android:xlargeScreens="true"
android:largeScreens="true"
android:normalScreens="true"
android:smallScreens="true"
android:anyDensity="true"/>)
#SetApplicationAttribute(android:icon, "@drawable/icon")
SetApplicationAttribute(android:label, "$LABEL$")
SetApplicationAttribute(android:largeHeap, "true")
'End of default text.

'Einstellung für Adaptive-icon
SetApplicationAttribute(android:icon, "@mipmap/ic_launcher")
CreateResource(mipmap-anydpi-v26, ic_launcher.xml,
<adaptive-icon xmlns:android="http://schemas.android.com/apk/res/android">
<background android:drawable="@mipmap/background"/>
<foreground android:drawable="@mipmap/foreground"/>
</adaptive-icon>
)

AddPermission(android.permission.WRITE_SETTINGS)
AddPermission(android.permission.ACCESS_NETWORK_STATE)

'************ Crashlytics components ************
'Google Play Services Base - Always required when using Google Play Services or Firebase:
CreateResourceFromFile(Macro, FirebaseAnalytics.GooglePlayBase)

'Firebase Analytics
CreateResourceFromFile(Macro, FirebaseAnalytics.Firebase)

'Crashlytics components
CreateResourceFromFile(Macro, FirebaseAnalytics.Crashlytics)
'End of Crashlytics components

'GooglePlayBilling - In App Purchases
CreateResourceFromFile(Macro, GooglePlayBilling.GooglePlayBilling)
'End of GooglePlayBilling

'************ Android-Themen ************
SetApplicationAttribute(android:theme, "@style/MyAppTheme")
CreateResource(values, theme.xml,
<resources>
<style name="MyAppTheme" parent="Theme.AppCompat.Light.NoActionBar">
<item name="colorPrimary">#607D8B</item>
<item name="colorPrimaryDark">#455A64</item>
<item name="colorAccent">#607D8B</item>
<item name="windowNoTitle">true</item>
<item name="windowActionBar">false</item>
</style>

<style name="ToolbarMenu" parent="Base.ThemeOverlay.AppCompat.ActionBar">
<item name="android:textColorPrimary">#fff</item>
<item name="android:colorBackground">#0098FF</item>
</style>
</resources>
)
'End of Android-Themen

'************ File Provider ****************
'E-Mail senden ab Android 6+
AddApplicationText(
<provider
android:name="android.support.v4.content.FileProvider"
android:authorities="$PACKAGE$.provider"
android:exported="false"
android:grantUriPermissions="true">
<meta-data
android:name="android.support.FILE_PROVIDER_PATHS"
android:resource="@xml/provider_paths"/>
</provider>
)
CreateResource(xml, provider_paths,
<external-files-path name="name" path="" />
)
'Ende of File Provider

'intent-filter
AddReceiverText(smUSB, <intent-filter>
<action android:name="android.hardware.usb.action.USB_DEVICE_ATTACHED"/>
<action android:name="android.hardware.usb.action.USB_DEVICE_DETACHED"/>
</intent-filter>)
 

Filippo

Expert
Licensed User
Longtime User
It is not related to ads.
This crash can happen when Google Play Services is missing.

Try this: https://www.b4x.com/android/forum/threads/check-and-install-google-play-services.84813/#content
Thanks Erel!
I thought that it was only necessary for advertising.
That is, you should check in each app with "CheckForGooglePlayServices" whether the "Google Play Services" is present, right?

Is this line still required?
1663575681555.png
 
Last edited:
Upvote 0
Top