When I include google maps my build fails - google-maps

When I include a "google maps" dependency into pubspec.yaml
google_maps_flutter: ^0.2.0+3
my build fails with:
Launching lib\main.dart on Android SDK built for x86 in debug mode...
D8: Program type already present: android.support.v4.media.MediaBrowserCompat$ConnectionCallback$ConnectionCallbackInternal
*********************************************************
WARNING: This version of google_maps_flutter will break your Android build if it or its dependencies aren't compatible with AndroidX.
See xxxxxxxxxxx for more information on the problem and how to fix it.
This warning prints for all Android build failures. The real root cause of the error may be unrelated.
*********************************************************
FAILURE: Build failed with an exception.
What went wrong:
Execution failed for task ':app:transformDexArchiveWithExternalLibsDexMergerForDebug'.
com.android.builder.dexing.DexArchiveMergerException: Error while merging dex archives: C:\Users\philb\flutter_course2\build\app\intermediates\transforms\dexBuilder\debug\4.jar, C:\Users\philb\flutter_course2\build\app\intermediates\transforms\dexBuilder\debug\5.jar, C:\Users\philb\flutter_course2\build\app\intermediates\transforms\dexBuilder\debug\6.jar, C:\Users\philb\flutter_course2\build\app\intermediates\transforms\dexBuilder\debug\7.jar, C:\Users\philb\flutter_course2\build\app\intermediates\transforms\dexBuilder\debug\8.jar, C:\Users\philb\flutter_course2\build\app\intermediates\transforms\dexBuilder\debug\9.jar, C:\Users\philb\flutter_course2\build\app\intermediates\transforms\dexBuilder\debug\10.jar, C:\Users\philb\flutter_course2\build\app\intermediates\transforms\dexBuilder\debug\11.jar, C:\Users\philb\flutter_course2\build\app\intermediates\transforms\dexBuilder\debug\12.jar, C:\Users\philb\flutter_course2\build\app\intermediates\transforms\dexBuilder\debug\13.jar, C:\Users\philb\flutter_course2\build\app\intermediates\transforms\dexBuilder\debug\14.jar, C:\Users\philb\flutter_course2\build\app\intermediates\transforms\dexBuilder\debug\15.jar, C:\Users\philb\flutter_course2\build\app\intermediates\transforms\dexBuilder\debug\16.jar, C:\Users\philb\flutter_course2\build\app\intermediates\transforms\dexBuilder\debug\17.jar, C:\Users\philb\flutter_course2\build\app\intermediates\transforms\dexBuilder\debug\18.jar, C:\Users\philb\flutter_course2\build\app\intermediates\transforms\dexBuilder\debug\19.jar, C:\Users\philb\flutter_course2\build\app\intermediates\transforms\dexBuilder\debug\20.jar, C:\Users\philb\flutter_course2\build\app\intermediates\transforms\dexBuilder\debug\21.jar, C:\Users\philb\flutter_course2\build\app\intermediates\transforms\dexBuilder\debug\22.jar, C:\Users\philb\flutter_course2\build\app\intermediates\transforms\dexBuilder\debug\23.jar, C:\Users\philb\flutter_course2\build\app\intermediates\transforms\dexBuilder\debug\24.jar, C:\Users\philb\flutter_course2\build\app\intermediates\transforms\dexBuilder\debug\25.jar, C:\Users\philb\flutter_course2\build\app\intermediates\transforms\dexBuilder\debug\26.jar, C:\Users\philb\flutter_course2\build\app\intermediates\transforms\dexBuilder\debug\27.jar, C:\Users\philb\flutter_course2\build\app\intermediates\transforms\dexBuilder\debug\28.jar, C:\Users\philb\flutter_course2\build\app\intermediates\transforms\dexBuilder\debug\29.jar, C:\Users\philb\flutter_course2\build\app\intermediates\transforms\dexBuilder\debug\30.jar, C:\Users\philb\flutter_course2\build\app\intermediates\transforms\dexBuilder\debug\31.jar, C:\Users\philb\flutter_course2\build\app\intermediates\transforms\dexBuilder\debug\32.jar, C:\Users\philb\flutter_course2\build\app\intermediates\transforms\dexBuilder\debug\33.jar, C:\Users\philb\flutter_course2\build\app\intermediates\transforms\dexBuilder\debug\34.jar, C:\Users\philb\flutter_course2\build\app\intermediates\transforms\dexBuilder\debug\35.jar, C:\Users\philb\flutter_course2\build\app\intermediates\transforms\dexBuilder\debug\36.jar, C:\Users\philb\flutter_course2\build\app\intermediates\transforms\dexBuilder\debug\50.jar, C:\Users\philb\flutter_course2\build\app\intermediates\transforms\dexBuilder\debug\55.jar, C:\Users\philb\flutter_course2\build\app\intermediates\transforms\dexBuilder\debug\60.jar, C:\Users\philb\flutter_course2\build\app\intermediates\transforms\dexBuilder\debug\65.jar, C:\Users\philb\flutter_course2\build\app\intermediates\transforms\dexBuilder\debug\70.jar, C:\Users\philb\flutter_course2\build\app\intermediates\transforms\dexBuilder\debug\75.jar, C:\Users\philb\flutter_course2\build\app\intermediates\transforms\dexBuilder\debug\80.jar, C:\Users\philb\flutter_course2\build\app\intermediates\transforms\dexBuilder\debug\85.jar, C:\Users\philb\flutter_course2\build\app\intermediates\transforms\dexBuilder\debug\90.jar, C:\Users\philb\flutter_course2\build\app\intermediates\transforms\dexBuilder\debug\95.jar, C:\Users\philb\flutter_course2\build\app\intermediates\transforms\dexBuilder\debug\100.jar, C:\Users\philb\flutter_course2\build\app\intermediates\transforms\dexBuilder\debug\105.jar, C:\Users\philb\flutter_course2\build\app\intermediates\transforms\dexBuilder\debug\110.jar, C:\Users\philb\flutter_course2\build\app\intermediates\transforms\dexBuilder\debug\115.jar
Can someone point me in the right direction to understand and track this down. This project built just fine previously.

This is because you have in your app google_maps_plugin version that is using androidx and probably your app and/or some other dependency is using android support library. I had provided some ways to solve this kind of problem here and here.
But what you need to do is migrate all your app to androidx and use updated dependencies versions that already has been migrated too.
Other way is avoid androidx making downgrade of your dependencies packages for versions pre androidx.
For more details about flutter apps androidx migration see the original docs reference
I hope it helps.

Related

Didn't find class "com.android.volley.toolbox.JsonObjectRequest" on path: DexPathList

I am using https://github.com/DWorkS/VolleyPlus library for implementing multipart in my project but this library conflicted with compile 'com.android.volley:volley:1.0.0' dependency says " Program type already present: com.android.volley.BuildConfig" for this i included configurations {all*.exclude group:'com.android.volley'} im my build.gradle then it worked fine.But when i integrated places api in my app and starts seaching places ,the app crashes and
it prompt error 'Didn't find class "com.android.volley.toolbox.JsonObjectRequest" on path: DexPathList'.
Please help me!

java.lang.UnsatisfiedLinkError: com.chrysalisits.crypto.LunaAPI.Initialize()V

I am getting below exception while running my application.
Caused by: java.lang.UnsatisfiedLinkError:
com.chrysalisits.crypto.LunaAPI.Initialize()V
at com.chrysalisits.crypto.LunaAPI.Initialize(Native Method)
at com.chrysalisits.crypto.LunaTokenManager.(LunaTokenManager.java:107)
at com.chrysalisits.crypto.LunaTokenManager.getInstance(LunaTokenManager.java:62)
I have added LunaProvider.jar and libLunaAPI in $JAVA_HOME/jre/lib/ext.
I strongly recommend that you ask the HSM Support Team for help on this instead of Stackoverflow.
This error comes up if Java is not able to find the concerned .so / .dll (Library) file. Also, make sure that you have the correct 32 / 64 Bit version of the Library in the location.
That said, in the VM Arguments you could also set :
-Djava.library.path=/location_to_the_libLunaAPI_so_file (possibly, /usr/lunasa/JSP/lib .. or something)
I have solved my problem.
Actual Problem was mismatch between native client library (libLunaAPI.so) and Luna client.
My application was using old library's com.chrysalisits.crypto.* classes to interact with Luna client however my Luna client got updated and functions which it exposed in its native library was not present in current library.
I updated my client application by using com.safenetinc.luna.* classes and latest client library.

Sonar Unit tests report parameter - sonar.junit.reportPath vs sonar.java.junit.reportPath

I found that my Sonar instance 5.1 or 5.1.1 (with latest sonar-runner 2.x) stopped showing part of the Unit test info (Unit test widget) on the project's dashboard.
The properties I had were (in Gradle's sonarRunner > sonarProperties section):
property "sonar.junit.reportsPath", "build/test-results/UT"
property "sonar.surefire.reportsPath", "build/test-results/UT"
To fix it, I had to include the following properties as well:
property "sonar.java.junit.reportsPath", "build/test-results/UT"
property "sonar.java.surefire.reportsPath", "build/test-results/UT"
Just FYI: All my Unit tests reports go under build/test-results/UT folder, all Integration Tests result files go unedr build/test-results/IT folder and etc.
I'm wondering if this is due to Gradle version that I'm using (2.3) or is it due to a later version of SonarQube (4.5+) as I have both SQ 5.1 and 5.1.1 instance.
I know SonarQube team started Multi language support since SonarQube version 4.12
Since SonarQube 4.2, it is possible to run an analysis on a multi-language project.
Now, it raises a question. For Getting the same Unit test info for Groovy based projects, do I need to use:
property "sonar.groovy.junit.reportsPath", "build/test-results/UT"
property "sonar.groovy.surefire.reportsPath", "build/test-results/UT"
something like that if my project has Groovy code instead of java?
Searching "**sonar.java.junit.reportPath"** with using double quotes shows No results found in Google and it forces me to try and see google results if I can run the search again without using " double quotes (for this property).
Doing the same in SonarQube site "search box" shows:
No results found for sonar.java.junit.reportPath. Please try one of the following suggestions:
Though in Gradle, inside
sonarRunner task {
.. inside ..
sonarProperties {
... section ... where I define various sonar props..
}
...
}
I can define both sonar.junit.reportPath, sonar.java.junit.reportPath and similarly, sonar.surefire.reporPath and sonar.java.surefire.reportPath and while running sonarRunner task in Gradle, it doesn't error out. Thus it makes me believe that the property variables are valid.
There are also issues with running sonarRunner or stand alone sonar-runner command for a mixed Java and Groovy based project (i.e. source code in Java but tests in Groovy). Setting sonar.language=java,grvy didn't help. I posted this question on stackoverflow but so far I have no perfect result/answer on how to get a full fledged sonar dashboard up and running for a Groovy projects like I get for a Java project.
Groovy project - Sonar - Publish project and Unit + Integration Test code coverage data
PS: I have tried various values for setting sonar.. variables (as far a sonar source, tests, etc, etc properties are concerned, which they have mentioned on their site's docs section)
The only valid property to use as of now is sonar.junit.reportsPath which will tell the java sonarqube plugin where to import your result of unit tests.
For groovy, this is work in progress, see : http://jira.sonarsource.com/browse/SONARGROOV-2
All the other properties you mentioned do not exist and are not taken into account.

Air publishing game error

I receive this error durring the publishing of my game.
Error creating files. dx tool failed :
UNEXPECTED TOP-LEVEL EXCEPTON: java.lang.illegalArgumentException:
already added : android/support/v7/appcomapt/R$anim;
at com.android.dx.dex.file.ClassDefsSection.add(ClassDefsSection.java.123)....
(is long error)
I have included an ane for ads (AIRPUSH)
When I run that ane in new project it's working perfectlly.
What can be the problem?
I've faced this one before.
The exception tells you that the android-support-v7 library's R class (See R* mechanism with ANEs) is being packaged twice. Which explains why it works fine with a new ANE project.
Please check if you have them included inside your ANE's platform.xml as a <packagedResource> (If so remove it from here)
OR
Check if it is being added from inside one of your other ANEs.

Failed to resolve Android.App.Fragment with Link SDK Only enabled

I'm getting compile time error when linker option = "SDK Only" with "Failed to resolve Android.App.Fragment" message. It's all started when I added Google Maps support with FragmentActivity to my MonoDroid application.
With Linker option = "None" everything works just fine except of the fact that .apk became huge (~30mb instead of 7mb when link SDK Only enabled)
Error details:
The "LinkAssemblies" task failed unexpectedly.
Mono.Cecil.ResolutionException: Failed to resolve Android.App.Fragment
at Mono.Linker.Steps.MarkStep.MarkType(TypeReference reference)
at Mono.Linker.Steps.MarkStep.MarkType(TypeReference reference)
at Mono.Linker.Steps.MarkStep.InitializeType(TypeDefinition type)
at Mono.Linker.Steps.MarkStep.InitializeAssembly(AssemblyDefinition assembly)
at Mono.Linker.Steps.MarkStep.Initialize()
at Mono.Linker.Steps.MarkStep.Process(LinkContext context)
at Mono.Linker.Pipeline.Process(LinkContext context)
at MonoDroid.Tuner.Linker.Process(LinkerOptions options, LinkContext& context)
at Xamarin.Android.Tasks.LinkAssemblies.Execute()
at Microsoft.Build.BackEnd.TaskExecutionHost.Microsoft.Build.BackEnd.ITaskExecutionHost.Execute()
at Microsoft.Build.BackEnd.TaskBuilder.<ExecuteInstantiatedTask>d__20.MoveNext()
I found a lot of similar problems (1, 2, 3) and the only proposed solution was to disable linker which is not the case for my app.
How can I diagnose and fix the issue?
TIA!
Are you referencing Mono.Android.Support.v4 classes everywhere?
I've been struggling with the same issue on and off for a while now. Currently, I have had success in switching to the Alpha channel of Xamarin Updates and using the alpha builds of Xamarin.Android and Xamarin Studio. Running those alphas, I have been able to make release builds with Linking enabled with no issues. Hope that helps!
Eventually GooglePlayServices Xamarin Component has been updated to 12.0.1 and not it could used without any errors even with "SDK Only" linker flag. You can use it right from component store without any bindings pre-compilation.