Air publishing game error - actionscript-3

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.

Related

When I include google maps my build fails

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.

Error: VB runtime is not loaded

Edited version, after suggestion from community:
In a Windows 8.1 Phone project (Part of a VB.Net Solution with also a Store app and a Portable Class Library) I get this error message:
Call not possible because VB Runtime is not loaded.
but as far as I can trace the code keeps running in spite of this. Until... eventually an error pops up, telling me that
Could not find Windows Runtime type 'Windows.foundation'
What I have found so far on this subject seems to have a relation with Silverlight and very old versions of VB Runtime. Nothing recent.
Further on during execution in the error trap the following explanation is given:
at System.StubHelpers.WinRTTypeNameConverter.GetTypeFromWinRTTypeName(String typeName, Boolean& isPrimitive)
at System.StubHelpers.SystemTypeMarshaler.ConvertToManaged(TypeNameNative* pNativeType, Type& managedType)
at Windows.UI.Xaml.Controls.Frame.Navigate(Type sourcePageType)
at Dossier365.Mobile.Behaviors.MenuTegelClickAction.ReageerOpMenuKeuze(Object sender, Object parameter).
I have attached a screenshot with the different messages. The Store App runs fine, based on the same PCL.
EDIT: after suggestions below: added DirectCast:
Now a new error message appears: I have no clue what goes on here or moreover: how to overcome this situation. My attempts so far have not lead to a workable solution.
Anyone with a good suggestion or solution?

libGDX HTML5 deployment exception

I am trying to compile the libGDX project using GWT (libgdx-project-html right click -> Google -> GWT Compile).
I get no errors while compiling except
com.badlogic.gdx.scenes.scene2d.utils.DragAndDrop.Target
java.lang.StringIndexOutOfBoundsException
but since I'm not using this util should not be a problem.
After the compilation says that it was successful, I ran the local hosted site.
LibGDX logo and loading bar come up (fine until here), and when they are done, I get a black game screen and a box below it with unlimited
GwtApplication: exception: (TypeError) : Cannot call method
'nullMethod' of null (TypeError) : Cannot call method 'nullMethod' of
null
message lines.
In the console the following message is repeated continuously:
Uncaught java.lang.RuntimeException:
com.google.gwt.core.client.JavaScriptException: (TypeError) : Cannot
call method 'nullMethod' of null (anonymous function)
597957B2399D3903739C615799AE1A15.cache.html:11899
The project basically is nothing but the logo of libGDX that should come up and fill the game screen (the default one) and no code has been modified.
Some additional notes:
Desktop and Android compile and work flawlessly.
Console says SoundManager 2 loaded (OK) before that error message comes up.
Strict flag is set when GWT compiling and everything are compiled with no errors.
For anyone having the same problem or any other similar/weird exceptions.
Make sure that strict flag is set by adding
-strict
in the compiling arguments and most importantly, you are using
GL20
as WebGL is based on GL20 and doesn't support GL10.

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.

Strange errors when linking to libmariadb

I'm currently develop an Objective-C library that links to the MariaDB C connector. I believe there is a problem with the library, though.
Every time I execute my code I get very strange errors on the console. The -(id)init method of my library calls mysql_init(NULL) to initialise the library but as soon as I return from -(id)init I get the following errors in the console:
Object 0x10643df70 of class XXX autoreleased with no pool in place - just leaking - break on objc_autoreleaseNoPool() to debug
Thing is, there is no multithreaded code being executed and if I run the same - (id)init without the call to mysql_init(NULL) the errors disappear. I believe the libmariadb library is causing these errors to appear. I don't get why though.
Do I need to build it with any special command line switches? Am I calling the right methods? I obviously used the MySQL online documentation as a guide.
Make sure you add this anytime you have a new thread:
#autoreleasepool {
//enter code here
}
Have you tried latest revision from launchpad?
Also try to build libmariadb with -DUNDEF_THREADS_HACK and
CMAKE_USE_PTHREADS:BOOL=OFF)
I was busy with other stuff for a while. I've since updated MariaDB to the latest version and, as far as I can tell, it works fine.