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

Application has stopped (Android) #2167

Closed
lsilva23 opened this issue Mar 21, 2018 · 28 comments
Closed

Application has stopped (Android) #2167

lsilva23 opened this issue Mar 21, 2018 · 28 comments

Comments

@lsilva23
Copy link

lsilva23 commented Mar 21, 2018

I have this bug.
Yesterday I was building normally.
Today phonegap is compiling but when I install on Android I get this error:

03-21 15:06:10.381 10948-10948/? E/AndroidRuntime: FATAL EXCEPTION: main
                                                   Process: myapp.com, PID: 10948
                                                   java.lang.NoSuchMethodError: No static method checkNotNull(Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object; in class Lcom/google/android/gms/common/internal/zzbq; or its super classes (declaration of 'com.google.android.gms.common.internal.zzbq' appears in /data/app/myapp.com-2/base.apk)
                                                       at com.google.android.gms.maps.MapsInitializer.initialize(Unknown Source)
                                                       at plugin.google.maps.CordovaGoogleMaps$1.run(CordovaGoogleMaps.java:209)
                                                       at android.app.Activity.runOnUiThread(Activity.java:5874)
                                                       at plugin.google.maps.CordovaGoogleMaps.initialize(CordovaGoogleMaps.java:72)
                                                       at org.apache.cordova.CordovaPlugin.privateInitialize(CordovaPlugin.java:57)
                                                       at org.apache.cordova.PluginManager.getPlugin(PluginManager.java:171)
                                                       at org.apache.cordova.PluginManager.startupPlugins(PluginManager.java:97)
                                                       at org.apache.cordova.PluginManager.init(PluginManager.java:86)
                                                       at org.apache.cordova.CordovaWebViewImpl.init(CordovaWebViewImpl.java:117)
                                                       at org.apache.cordova.CordovaActivity.init(CordovaActivity.java:149)
                                                       at org.apache.cordova.CordovaActivity.loadUrl(CordovaActivity.java:224)
                                                       at myapp.com.MyApp.onCreate(MyApp.java:39)
                                                       at android.app.Activity.performCreate(Activity.java:6687)
                                                       at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1140)
                                                       at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2631)
                                                       at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2743)
                                                       at android.app.ActivityThread.-wrap12(ActivityThread.java)
                                                       at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1490)
                                                       at android.os.Handler.dispatchMessage(Handler.java:102)
                                                       at android.os.Looper.loop(Looper.java:154)
                                                       at android.app.ActivityThread.main(ActivityThread.java:6165)
                                                       at java.lang.reflect.Method.invoke(Native Method)
                                                       at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:888)
                                                       at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:778)
@wf9a5m75
Copy link
Member

Please share your project files on Github.

@Michazzz
Copy link

Same here, will do update on my github repo

@DifferentialityDevelopment
Copy link

DifferentialityDevelopment commented Mar 22, 2018

Having the exact same issue.

The error i'm getting is:
java.lang.NoSuchMethodError: com.google.android.gms.common.internal.zzbq.checkNotNull

According to what i've read so far, the issue should be able to be resolved by updating some dependencies, going to try that now and update here if I manage something.

@wf9a5m75
Copy link
Member

Without project files, how can I reproduce your issue?

@DifferentialityDevelopment

I managed to resolve my issue, was able to build successfully with play services v4.26
and I added two lines that forced the dependencies for com.google.android.gms:play-services-maps & com.google.android.gms:play-services-location to latest in my build.gradle.

dependencies {
implementation fileTree(dir: 'libs', include: '*.jar')
// SUB-PROJECT DEPENDENCIES START
implementation(project(path: ":CordovaLib"))
compile "com.google.android.gms:play-services-maps:11.8.0"
compile "com.google.android.gms:play-services-location:11.8.0"
compile "com.android.support:support-core-utils:24.1.0"
compile "com.google.android.gms:play-services-location:+"
compile "com.android.support:support-v4:27.1.0"
compile "com.android.support:appcompat-v7:26.+"
compile "com.squareup.okhttp3:okhttp:3+"
// SUB-PROJECT DEPENDENCIES END
compile "com.google.android.gms:play-services-location:+"
compile "com.google.android.gms:play-services-maps:+"
}

After that it built successfully and the app did not crash on load anymore.

@StobyWan
Copy link

StobyWan commented Mar 22, 2018

I am having the same problem on ionic. Using version 2.2.8 of the plugin. iOS working fine. If i remove the googlemaps plugin completely the app run fine. I have ci/cd so changing the android native app is not an option. I will work on providing a sample project today. You will need to use your own maps keys as a reminder when I submit.
cli packages: (/usr/local/lib/node_modules)
@ionic/cli-utils : 1.19.2
ionic (Ionic CLI) : 3.20.0
global packages:
cordova (Cordova CLI) : 8.0.0
local packages:
@ionic/app-scripts : 3.1.8
Cordova Platforms : android 7.0.0 ios 4.5.4
Ionic Framework : ionic-angular 3.9.2
System:
Android SDK Tools : 26.1.1
ios-deploy : 1.9.2
ios-sim : 6.1.2
Node : v8.9.4
npm : 5.6.0
OS : macOS High Sierra
Xcode : Xcode 9.2 Build version 9C40b
Environment Variables:
ANDROID_HOME : /Users/*/Library/Android/sdk
Misc: backend : pro

@lsilva23
Copy link
Author

@DifferentialityDevelopment
How do you change your build.gradle files using cordova?
Is there a way of doing this with config.xml?

@StobyWan
Copy link

StobyWan commented Mar 22, 2018

@lsilva23 I think you would need a custom hook. But I have not done that for the android gradle stuff. It might be best to wait for a fix on this from the plugin owners... something happened between 2.2.5 and the latest to create this break. I am sure it can be resolved on their end... hopefully.

@DifferentialityDevelopment

I'm using the Ionic framework which uses cordova, you'll find the gradle file you need to edit under /platforms/android/app/build.gradle,
Look for // SUB-PROJECT DEPENDENCIES END
You'll have to put the two lines after that because before will cause it to be overwritten.
A custom hook could work too as StobyWan just mentioned. I don't remove and add my platform all that much so I've simply mentioned the fix in my project's README.MD so I don't forget about it.

The version I was using when it happened was 11.8.0 and after changing to + the issue went away.

@wf9a5m75
Copy link
Member

@StobyWan
I guess there are two definitions of com.android.support:support-core-utils

This is not bug, it's just conflict with other plugin, such as the google-plus plugin.
Choosing what plugin is your responsibility. If conflict, you need to adjust them.

@lsilva23
Copy link
Author

@wf9a5m75 This is my Project: http://sistema.99car.club/pdrcar.apk

@wf9a5m75
Copy link
Member

Please share your project files on Github.

@lsilva23
Copy link
Author

And on my build log in Phonegap I am getting this:
:app:lintVitalRelease/app/src/main/res/values/strings.xml:3: Error: "app_name" is not translated in "ar" (Arabic), "de" (German), "fr" (French), "hi" (Hindi), "ja" (Japanese), "nl" (Dutch), "pl" (Polish), "pt-PT" (Portuguese: Portugal), "ru" (Russian), "uk" (Ukrainian) [MissingTranslation]
Pdr Car Cliente
~~~~~~~~~~~~~~~
/app/src/main/res/values/strings.xml:4: Error: "launcher_name" is not translated in "ar" (Arabic), "de" (German), "fr" (French), "hi" (Hindi), "ja" (Japanese), "nl" (Dutch), "pl" (Polish), "pt-PT" (Portuguese: Portugal), "ru" (Russian), "uk" (Ukrainian) [MissingTranslation]
@string/app_name
~~~~~~~~~~~~~~~~~~~~
/app/src/main/res/values/strings.xml:5: Error: "activity_name" is not translated in "ar" (Arabic), "de" (German), "fr" (French), "hi" (Hindi), "ja" (Japanese), "nl" (Dutch), "pl" (Polish), "pt-PT" (Portuguese: Portugal), "ru" (Russian), "uk" (Ukrainian) [MissingTranslation]
@string/launcher_name
~~~~~~~~~~~~~~~~~~~~

Explanation for issues of type "MissingTranslation":
If an application has more than one locale, then all the strings declared
in one language should also be translated in all other languages.

If the string should not be translated, you can add the attribute
translatable="false" on the element, or you can define all your
non-translatable strings in a resource file called donottranslate.xml. Or,
you can ignore the issue with a tools:ignore="MissingTranslation"
attribute.

By default this detector allows regions of a language to just provide a
subset of the strings and fall back to the standard language strings. You
can require all regions to provide a full translation by setting the
environment variable ANDROID_LINT_COMPLETE_REGIONS.

You can tell lint (and other tools) which language is the default language
in your res/values/ folder by specifying tools:locale="languageCode" for
the root element in your resource file. (The tools prefix
refers to the namespace declaration http://schemas.android.com/tools.)

3 errors, 0 warnings

@DifferentialityDevelopment
Copy link

DifferentialityDevelopment commented Mar 22, 2018

@wf9a5m75 I can't seem to agree on this, the app works fine but only causes this issue for me on the lowest supported android version of API 19, ie 4.4.4.
I don't necessarily think it's a bug with the plugin though, nevertheless making sure the app is built with the latest dependencies as I mentioned above seems to fix the issue.

@lsilva23 I don't think those translation issues are related to the crash.

@lsilva23
Copy link
Author

lsilva23 commented Mar 22, 2018

@DifferentialityDevelopment
Are you talking about preference name="android-minSdkVersion" value="16" this?

@DifferentialityDevelopment

@lsilva23 Does your app crash on startup or on install?
The error I had on startup was
java.lang.NoSuchMethodError: com.google.android.gms.common.internal.zzbq.checkNotNull
at com.google.android.gms.maps.MapsInitializer.initialize(Unknown Source)

@lsilva23
Copy link
Author

@DifferentialityDevelopment On startup! It build successful on Phonegap and Install successful on Android 5.1/7.0

@DifferentialityDevelopment

@lsilva23 Did you try the fix I stated earlier of modifying the build.gradle file?

@lsilva23
Copy link
Author

@DifferentialityDevelopment I can't find my build.gradle file, I will post my project files so you can see how I am doing this

@lsilva23
Copy link
Author

lsilva23 commented Mar 22, 2018

I fixed!
Just had to put those variables:

<plugin name="cordova-plugin-googlemaps" spec="^2.2.8">
		<variable name="PLAY_SERVICES_VERSION" value="+" />
		<variable name="ANDROID_SUPPORT_V4_VERSION" value="24.1.0" />
		<variable name="LOCATION_WHEN_IN_USE_DESCRIPTION" value="Aplicativo precisa de sua localização!" />
		<variable name="LOCATION_ALWAYS_USAGE_DESCRIPTION" value="Aplicativo precisa de sua localização!" />
	</plugin>

Thank you guys for your time!

@DifferentialityDevelopment

Lol, glad you got it fixed.

@wf9a5m75
Copy link
Member

@DifferentialityDevelopment

If you were a plugin developer, and someone reports only logs, what whould you do?
It's not only one, tons of people.
So you would spend your private time for debugging other people problems.
Would you like it?

I don't like it. That's why I ask for everyone to share the project files. Because this is shortest way to solve the problem.
I asked "please share your project files on GitHub", but I don't specify as public repository.
If you don't want to discover your code in public, you just buy a private repo.

You don't agree it? Please just debug the issue by yourself.

@Michazzz
Copy link

@wf9a5m75 I will try to upload my project file (plugin) tomorrow (23 March) from airport, because then I get some time do rebuild my project. I will let you know about it if you want, ok?

@wf9a5m75
Copy link
Member

Yeah, let me know when you are ready please.

@wf9a5m75 wf9a5m75 mentioned this issue Mar 23, 2018
5 tasks
@hackeo1
Copy link

hackeo1 commented Mar 23, 2018

Adding <variable name="PLAY_SERVICES_VERSION" value="+" /> did the trick, it may be that 11.8.0 should change to 12.0.0 in the future.

@DifferentialityDevelopment

@Hackeo Ah! Thanks for that!

@wf9a5m75
Copy link
Member

Plugin configuration is responsibility of app developer, not me, because it's depends on when, and what other plugins you install. In the past, so many people claimed <variable name="PLAY_SERVICES_VERSION" value="+" /> because conflict with other plugins.
You can select +, but take the risk with your responsibility please.

@wf9a5m75
Copy link
Member

Since it seems the reason is the build configuration, and everyone are solved thier problems, I close this thread.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

6 participants