mapsplugin / cordova-plugin-googlemaps

Google Maps plugin for Cordova
Apache License 2.0
1.66k stars 913 forks source link

cordova geofence issue #2197

Closed bigbossmaher closed 6 years ago

bigbossmaher commented 6 years ago

i tried to install this https://github.com/OutSystems/cordova-plugin-geofence you will find the build log bellow. and this is the github https://github.com/bigbossmaher/TUNPARK-NEW-geofence

I'm submitting a ... (check one with "x")

If you choose 'problem or bug report', please select OS: (check one with "x")

com.lampa.startapp 0.1.4 "startApp" cordova-plugin-actionsheet 2.3.3 "ActionSheet" cordova-plugin-add-swift-support 1.7.2 "AddSwiftSupport" cordova-plugin-compat 1.2.0 "Compat" cordova-plugin-device 2.0.1 "Device" cordova-plugin-dialogs 2.0.1 "Notification" cordova-plugin-geofence 0.5.0 "geofence" cordova-plugin-geolocation 4.0.1 "Geolocation" cordova-plugin-globalization 1.0.9 "Globalization" cordova-plugin-googlemaps 2.2.9 "cordova-plugin-googlemaps" cordova-plugin-inappbrowser 2.0.2 "InAppBrowser" cordova-plugin-insomnia 4.3.0 "Insomnia (prevent screen sleep)" cordova-plugin-splashscreen 5.0.2 "Splashscreen" cordova-plugin-statusbar 2.4.1 "StatusBar" cordova-plugin-whitelist 1.3.3 "Whitelist" es6-promise-plugin 4.2.2 "Promise" uk.co.workingedge.phonegap.plugin.launchnavigator 4.2.0 "Launch Navigator"

:app:transformClassesWithDexBuilderForDebug
:app:transformDexArchiveWithExternalLibsDexMergerForDebug FAILED

37 actionable tasks: 11 executed, 26 up-to-date
FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':app:transformDexArchiveWithExternalLibsDexMergerForDebug'.
> java.lang.RuntimeException: java.lang.RuntimeException: com.android.builder.dexing.DexArchiveMergerException: Unable to merge dex

* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.

* Get more help at https://help.gradle.org

BUILD FAILED in 56s
(node:13352) UnhandledPromiseRejectionWarning: Error: cmd: Command failed with exit code 1 Error output:
Note: Some input files use or override a deprecated API.
Note: Recompile with -Xlint:deprecation for details.
Note: Some input files use unchecked or unsafe operations.
Note: Recompile with -Xlint:unchecked for details.

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':app:transformDexArchiveWithExternalLibsDexMergerForDebug'.
> java.lang.RuntimeException: java.lang.RuntimeException: com.android.builder.dexing.DexArchiveMergerException: Unable to merge dex

* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.

* Get more help at https://help.gradle.org

BUILD FAILED in 56s
    at ChildProcess.whenDone (c:\TUNPARK-NEW\platforms\android\cordova\node_modules\cordova-common\src\superspawn.js:169:23)
    at emitTwo (events.js:126:13)
    at ChildProcess.emit (events.js:214:7)
    at maybeClose (internal/child_process.js:925:16)
    at Process.ChildProcess._handle.onexit (internal/child_process.js:209:5)
(node:13352) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). (rejection id: 1)
(node:13352) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.
wf9a5m75 commented 6 years ago

Ah, I faced this yesterday.


In order to build, you need to modify the build.gradle file. https://github.com/bigbossmaher/TUNPARK-NEW-geofence/blob/93ae9df7ae9aa4f6a112d59f16a3807dd4f02846/platforms/android/app/build.gradle#L259-L268

The reason of this problem is there are two definitions for the same library.

    compile "com.google.android.gms:play-services-location:11.8.0"   <--- here
    compile "com.google.android.gms:play-services-maps:12.0.0"
    compile "com.google.android.gms:play-services-location:12.0.0"   <--- here
    compile "com.android.support:support-core-utils:24.1.0"

So remove one of them. Also v12.0.1 is available.

    compile "com.google.android.gms:play-services-maps:12.0.1"
    compile "com.google.android.gms:play-services-location:12.0.1" 
    compile "com.android.support:support-core-utils:24.1.0"

But you still get the same error. Because the geofence plugin installs gson-2.3.jar. https://github.com/bigbossmaher/TUNPARK-NEW-geofence/blob/93ae9df7ae9aa4f6a112d59f16a3807dd4f02846/platforms/android/app/libs/gson-2.3.jar

It's already too old. Remove it.

But the geofence plugin needs it. You can add it using gradle.

    compile 'com.google.code.gson:gson:2.8.2'

So at the end, the build.gradle file becomes like this:

dependencies {
    implementation fileTree(dir: 'libs', include: '*.jar')
    // SUB-PROJECT DEPENDENCIES START
    implementation(project(path: ":CordovaLib"))
    compile "com.google.android.gms:play-services-maps:12.0.1"
    compile "com.google.android.gms:play-services-location:12.0.1"
    compile "com.android.support:support-core-utils:24.1.0"
    compile 'com.google.code.gson:gson:2.8.2'
    // SUB-PROJECT DEPENDENCIES END
}
wf9a5m75 commented 6 years ago

I committed the modified version to your repo (the modified branch). https://github.com/bigbossmaher/TUNPARK-NEW2/tree/modified

wf9a5m75 commented 6 years ago

I think https://github.com/OutSystems/cordova-plugin-geofence is out-of-dated. It seems nobody maintained in last 11 months.

wf9a5m75 commented 6 years ago

ping

bigbossmaher commented 6 years ago

Hello , just i need some more time. Because i'm.not in my desktop today , give me. Only 8 hours.

wf9a5m75 commented 6 years ago

ok

bigbossmaher commented 6 years ago

hello sorry for delay , but seems that you have commited modifications on the wrong git . the files are in TUNPARK-NEW-geofence but you committed in TUNPARK-NEW2 both have a different geofence versions. so the modifications should be in TUNPARK-NEW-geofence can you please solve it . :)

wf9a5m75 commented 6 years ago

Did you try to resolve the issue by yourself?

bigbossmaher commented 6 years ago

i tried to modify the build.gradle directly like you told me , but every time i make cordova run android , it this file is regenerated and modification is gone . as a solution i added those lines in project.proprieties target=android-26 android.library.reference.1=CordovaLib android.library.reference.2=app cordova.gradle.include.1=cordova-plugin-googlemaps/tn-tbxml-android.gradle cordova.system.library.2=com.google.android.gms:play-services-maps:12.0.0 cordova.system.library.3=com.google.android.gms:play-services-location:12.0.0 cordova.system.library.4=com.android.support:support-core-utils:24.1.0 cordova.system.library.4=com.google.code.gson:gson:2.8.2

now the build.gradle is generated like you told me exacly but i still gettig errors

wf9a5m75 commented 6 years ago

Did you update your repo?

bigbossmaher commented 6 years ago

no , never.

wf9a5m75 commented 6 years ago

I mean could you update this repo with your current files? https://github.com/bigbossmaher/TUNPARK-NEW2

bigbossmaher commented 6 years ago

i will explain to you what i'm doing exacly . the repo https://github.com/bigbossmaher/TUNPARK-NEW2 is containg cordova-geofence 0.8.0 and it is working perfectly. now what i'm trying to do is to install a modified version of cordova-geofence 0.5.0 that have a happensOnce Feature in https://github.com/bigbossmaher/TUNPARK-NEW-geofence . what i mean that we should forget https://github.com/bigbossmaher/TUNPARK-NEW2 repo . our work will be in https://github.com/bigbossmaher/TUNPARK-NEW-geofence . thanks

wf9a5m75 commented 6 years ago

Ah, sorry URL is wrong. But I ask could you update the repo with your current files in order to reproduce your situation? https://github.com/bigbossmaher/TUNPARK-NEW-geofence

wf9a5m75 commented 6 years ago

Hey, I just built your app, but I was successful.

$> git clone https://github.com/bigbossmaher/TUNPARK-NEW-geofence
Cloning into 'TUNPARK-NEW-geofence'...
remote: Counting objects: 4908, done.
remote: Compressing objects: 100% (3258/3258), done.
remote: Total 4908 (delta 1053), reused 4908 (delta 1053), pack-reused 0
Receiving objects: 100% (4908/4908), 57.71 MiB | 12.76 MiB/s, done.
Resolving deltas: 100% (1053/1053), done.
Checking out files: 100% (6200/6200), done.

$> cd TUNPARK-NEW-geofence/

$> ls
config.xml      node_modules        package.json        plugins         www
hooks           package-lock.json   platforms       res

$> rm -rf platforms/

$> cordova prepare
Discovered platform "android@^7.0.0" in config.xml or package.json. Adding it to the project
Using cordova-fetch for cordova-android@^7.0.0
Adding android project...
Creating Cordova project for the Android platform:
    Path: platforms/android
    Package: com.parking.tn
    Name: TunPark
    Activity: MainActivity
    Android target: android-27
Subproject Path: CordovaLib
Subproject Path: app
Android project created with cordova-android@7.1.0
Android Studio project detected
Installing "cordova-plugin-compat" for android
Plugin doesn't support this project's cordova-android version. cordova-android: 7.1.0, failed version requirement: 
      <6.3.0
Skipping 'cordova-plugin-compat' for android
Android Studio project detected
Subproject Path: CordovaLib
Subproject Path: app
Subproject Path: CordovaLib
Subproject Path: app
Subproject Path: CordovaLib
Subproject Path: app
Subproject Path: CordovaLib
Subproject Path: app

$> cordova plugin list
com.lampa.startapp 0.1.4 "startApp"
cordova-plugin-actionsheet 2.3.3 "ActionSheet"
cordova-plugin-add-swift-support 1.7.2 "AddSwiftSupport"
cordova-plugin-compat 1.2.0 "Compat"
cordova-plugin-device 2.0.1 "Device"
cordova-plugin-dialogs 2.0.1 "Notification"
cordova-plugin-geofence 0.8.0 "geofence"
cordova-plugin-geolocation 4.0.1 "Geolocation"
cordova-plugin-globalization 1.0.9 "Globalization"
cordova-plugin-googlemaps 2.2.9 "cordova-plugin-googlemaps"
cordova-plugin-inappbrowser 2.0.2 "InAppBrowser"
cordova-plugin-insomnia 4.3.0 "Insomnia (prevent screen sleep)"
cordova-plugin-splashscreen 5.0.2 "Splashscreen"
cordova-plugin-statusbar 2.4.1 "StatusBar"
cordova-plugin-whitelist 1.3.3 "Whitelist"
es6-promise-plugin 4.2.2 "Promise"

$> cordvoa build android
-bash: cordvoa: command not found
masashi-macgms:TUNPARK-NEW-geofence masashi$ cordova build android
Android Studio project detected
ANDROID_HOME=/android-sdk
JAVA_HOME=/Library/Java/JavaVirtualMachines/jdk1.8.0_40.jdk/Contents/Home
studio
Parallel execution is an incubating feature.

BUILD SUCCESSFUL in 1s
1 actionable task: 1 executed
Subproject Path: CordovaLib
Subproject Path: app
Parallel execution is an incubating feature.
publishNonDefault is deprecated and has no effect anymore. All variants are now published.
Configuration 'compile' in project ':app' is deprecated. Use 'implementation' instead.
The Task.leftShift(Closure) method has been deprecated and is scheduled to be removed in Gradle 5.0. Please use Task.doLast(Action) instead.
    at build_7k2fxvh07xqp14c8wykexm7ep.run(/Users/masashi/Documents/workspace2/test/TUNPARK-NEW-geofence/platforms/android/app/build.gradle:144)
:CordovaLib:preBuild
:app:preBuild
:CordovaLib:preBuild UP-TO-DATE
:app:preBuild UP-TO-DATE
:CordovaLib:preDebugBuild UP-TO-DATE
:app:prepareLintJar
:CordovaLib:compileDebugAidl
:app:generateDebugResValues
:app:createDebugCompatibleScreenManifests
:CordovaLib:compileDebugRenderscript
:app:splitsDiscoveryTaskDebug
:app:mergeDebugShaders
:CordovaLib:checkDebugManifest
:CordovaLib:generateDebugBuildConfig
:CordovaLib:prepareLintJar
:app:compileDebugShaders
:CordovaLib:generateDebugResValues
:CordovaLib:generateDebugResources
:CordovaLib:packageDebugResources
:app:generateDebugAssets
:app:mergeDebugJniLibFolders
:app:validateSigningDebug
:CordovaLib:platformAttrExtractor
:CordovaLib:processDebugManifest
:CordovaLib:javaPreCompileDebug
:app:preDebugBuild
:CordovaLib:processDebugJavaRes NO-SOURCE
:CordovaLib:packageDebugRenderscript NO-SOURCE
:CordovaLib:mergeDebugShaders
:CordovaLib:compileDebugShaders
:CordovaLib:generateDebugAssets
:CordovaLib:mergeDebugAssets
:CordovaLib:compileDebugNdk NO-SOURCE
:CordovaLib:mergeDebugJniLibFolders
:CordovaLib:transformNativeLibsWithMergeJniLibsForDebug
:CordovaLib:transformNativeLibsWithStripDebugSymbolForDebug
:CordovaLib:transformNativeLibsWithIntermediateJniLibsForDebug
:CordovaLib:processDebugResources
:CordovaLib:generateDebugSources
:CordovaLib:compileDebugJavaWithJavac
:app:compileDebugAidl
:app:compileDebugRenderscript
:app:checkDebugManifest
:app:generateDebugBuildConfig
:app:generateDebugResources
:app:mergeDebugResourcesNote: Some input files use or override a deprecated API.
Note: Recompile with -Xlint:deprecation for details.

:app:processDebugManifest
:app:processDebugResources
:app:generateDebugSources
:app:compileDebugNdk NO-SOURCE
:app:mergeDebugAssets
:app:processDebugJavaRes NO-SOURCE
:CordovaLib:transformClassesAndResourcesWithPrepareIntermediateJarsForDebug
:app:javaPreCompileDebug
:app:compileDebugJavaWithJavacNote: Some input files use or override a deprecated API.
Note: Recompile with -Xlint:deprecation for details.
Note: Some input files use unchecked or unsafe operations.
Note: Recompile with -Xlint:unchecked for details.

:app:compileDebugSources
:app:transformClassesWithStackFramesFixerForDebug
:app:transformClassesWithDesugarForDebug
:app:transformClassesWithDexBuilderForDebug
:app:transformDexArchiveWithExternalLibsDexMergerForDebug
:app:transformDexArchiveWithDexMergerForDebug
:app:transformNativeLibsWithMergeJniLibsForDebug
:app:transformNativeLibsWithStripDebugSymbolForDebug
:app:transformResourcesWithMergeJavaResForDebug
:app:packageDebug
:app:assembleDebug
:app:cdvBuildDebug

BUILD SUCCESSFUL in 53s
48 actionable tasks: 48 executed
Built the following apk(s): 
    /Users/masashi/Documents/workspace2/test/TUNPARK-NEW-geofence/platforms/android/app/build/outputs/apk/debug/app-debug.apk
bigbossmaher commented 6 years ago

thank you for your help , but it seems i uploaded the wrong copy, because the cordova-plugin-geofence install is 0.8.0 can you build it with the version 0.5.0 with those commans ( and sorry ) cordova plugin rm cordova-plugin-geofence cordova plugin add https://github.com/OutSystems/cordova-plugin-geofence.git

wf9a5m75 commented 6 years ago

That's not this plugin's problem.

bigbossmaher commented 6 years ago

Geofence 0.5.0 is working very good with googlemaps 2.1.1 When i updated you plugin i got this issue

wf9a5m75 commented 6 years ago

You need to adjust the Google Play Service SDK version. Choosing which plugins which versions are your responsibility. Thus, plugin conflicting is also your responsibility. I gave lots of hits at least, and you said geofence 0.8.0 is fine. If you need to stay on the geofence 0.5.0, you should ask to the developer of the geofence plugin.

wf9a5m75 commented 6 years ago

Okay, I have a question.

If you create your JS code, and you publish it as open source code. Someone asks your JS code does not work with another JS code which is developed by other people, and it is old version. Do you want to support it?

bigbossmaher commented 6 years ago

Yes i understand , but the 0.5.0 have some features that not exist in 0.8.0 . i'm not too professional like you. I will be very thankful if you help me :heart:

wf9a5m75 commented 6 years ago

As I gave lots of hints, you need to adjust the versions of libraries.


dependencies {
    implementation fileTree(dir: 'libs', include: '*.jar')
    // SUB-PROJECT DEPENDENCIES START
    implementation(project(path: ":CordovaLib"))
    compile "com.google.android.gms:play-services-maps:12.0.0"
    compile "com.google.android.gms:play-services-location:12.0.0"
    compile "com.android.support:support-core-utils:24.1.0"
    compile "com.google.android.gms:play-services-location:+"
    // SUB-PROJECT DEPENDENCIES END
}
wf9a5m75 commented 6 years ago

ping

wf9a5m75 commented 6 years ago

Why do you send me new invitation ?

bigbossmaher commented 6 years ago

hello , i tried all my best during this period , i created a gradle file like you give me , but same issue , some times it is built but when opening it is show " application cessé de fonctionner " in english it mean app closed . i will give you the the git that works perfectly with geofence 0.8.0 https://github.com/bigbossmaher/TUNPARK-NEW-FF you will just rm the geofence and add this cordova plugin add https://github.com/OutSystems/cordova-plugin-geofence.git to see the problem. as you see the project took too much time , this is the last thing before showing it . thank you.

bigbossmaher commented 6 years ago

i just want to make sure the repository is clear without any issue and works perfectly before debugging it with geofence 0.5.0

wf9a5m75 commented 6 years ago

As I gave lots of hints, you just need to modify the build.gradle file, and as you noticed you also need to modify the project.properties file.


dependencies {
    implementation fileTree(dir: 'libs', include: '*.jar')
    // SUB-PROJECT DEPENDENCIES START
    implementation(project(path: ":CordovaLib"))
    compile "com.google.android.gms:play-services-maps:12.0.1"
    compile "com.google.android.gms:play-services-location:12.0.1"
    compile "com.android.support:support-core-utils:24.1.0"
    compile "com.google.code.gson:gson:2.6.2"
    // SUB-PROJECT DEPENDENCIES END
}
target=android-26
android.library.reference.1=CordovaLib
android.library.reference.2=app
cordova.system.library.1=com.google.android.gms:play-services-maps:12.0.1
cordova.gradle.include.1=cordova-plugin-googlemaps/tn-tbxml-android.gradle
cordova.system.library.2=com.google.android.gms:play-services-location:12.0.1
cordova.system.library.3=com.android.support:support-core-utils:24.1.0
cordova.system.library.5=com.google.code.gson:gson:2.6.2

Then clean the project at once. I used Android studio.

After that build your app, and run it.


Again, this is not my role.

wf9a5m75 commented 6 years ago
$ cordova plugin lsit
com.lampa.startapp 0.1.4 "startApp"
cordova-plugin-actionsheet 2.3.3 "ActionSheet"
cordova-plugin-add-swift-support 1.7.2 "AddSwiftSupport"
cordova-plugin-compat 1.2.0 "Compat"
cordova-plugin-device 2.0.1 "Device"
cordova-plugin-dialogs 2.0.1 "Notification"
cordova-plugin-geofence 0.5.0 "geofence"
cordova-plugin-geolocation 4.0.1 "Geolocation"
cordova-plugin-globalization 1.0.9 "Globalization"
cordova-plugin-googlemaps 2.2.9 "cordova-plugin-googlemaps"
cordova-plugin-inappbrowser 2.0.2 "InAppBrowser"
cordova-plugin-insomnia 4.3.0 "Insomnia (prevent screen sleep)"
cordova-plugin-splashscreen 5.0.2 "Splashscreen"
cordova-plugin-statusbar 2.4.1 "StatusBar"
cordova-plugin-whitelist 1.3.3 "Whitelist"
es6-promise-plugin 4.2.2 "Promise"
wf9a5m75 commented 6 years ago

https://github.com/wf9a5m75/tmp_TUNPARK-NEW-FF

bigbossmaher commented 6 years ago

thanks a lot , it works very good , i will make diff to see the source of the issue

wf9a5m75 commented 6 years ago

ping

bigbossmaher commented 6 years ago

the version that you sent me it works prefctly .but i can't get it from it . you told me to clear project , do you mean delete platform android then add it again ?

wf9a5m75 commented 6 years ago

Try cordova clean

wf9a5m75 commented 6 years ago

ping

bigbossmaher commented 6 years ago

yes it works perfectly . thanks

Le ven. 13 avr. 2018 à 17:28, Masashi Katsumata notifications@github.com a écrit :

ping

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/mapsplugin/cordova-plugin-googlemaps/issues/2197#issuecomment-381189580, or mute the thread https://github.com/notifications/unsubscribe-auth/AOc-FuSpoUTYyUE9DGR2TfZpeA5HbZXvks5toNIbgaJpZM4THp4W .