solve an error on build and android apk in unity - android

I download unity 2022.3.5 because its support jdk 11 and when build my app it show me this error:
Picked up JAVA_TOOL_OPTIONS: -Dfile.encoding=UTF-8
Warning: Failed to download any source lists!
Exception in thread "main" java.util.UnknownFormatConversionException: Conversion = '-'
at java.base/java.util.Formatter.checkText(Formatter.java:2732)
at java.base/java.util.Formatter.parse(Formatter.java:2718)
at java.base/java.util.Formatter.format(Formatter.java:2655)
at java.base/java.io.PrintStream.format(PrintStream.java:1053)
at java.base/java.io.PrintStream.printf(PrintStream.java:949)
at com.android.sdklib.tool.sdkmanager.TableFormatter.print(TableFormatter.java:72)
at com.android.sdklib.tool.sdkmanager.ListAction.printList(ListAction.java:197)
at com.android.sdklib.tool.sdkmanager.ListAction.execute(ListAction.java:80)
at com.android.sdklib.tool.sdkmanager.SdkManagerCli.run(SdkManagerCli.java:110)
at com.android.sdklib.tool.sdkmanager.SdkManagerCli.main(SdkManagerCli.java:87)
at com.android.sdklib.tool.sdkmanager.SdkManagerCli.main(SdkManagerCli.java:49)
UnityEngine.GUIUtility:ProcessEvent (int,intptr,bool&)
and it give me that error on screen:
enter image description here
it must give me back a list of sdk for continue build but i think problem is in
JAVA_TOOL_OPTIONS
i try to set a JAVA_TOOL_OPTIONS because i dont have it in enviroment varible
and i try to update sdkmanger by using this:sdkmanager --update

Related

Xamarin MultiDex in VisualStudio 2015

Hi everybody I'm in a dead end!
Develop a PCL application using VisualStudio 2015, Xamarin and MvvmCross.
The Android app exceeds the 65K limit. I need to use Multidex!
For its implementation I have undertaken these guidelines:
Enabled checkbox for MultiDex
Extended MultiDexApplication class
General considerations:
Debug mode
MinSdk: 21
TargetSdk: 25
BuildTools: 23.0.3
Jdk 1.8.0_121
Xamarin.Android 7.3
Results:
"java.exe" exited with code 2. C:\Program Files (x86)\MSBuild\Xamarin \Android\Xamarin.Android.Common.targets 1965
<!-- Compile java code to dalvik -->
<CompileToDalvik
DxJarPath="$(DxJarPath)"
JavaToolPath="$(JavaToolPath)"
JavaMaximumHeapSize="$(JavaMaximumHeapSize)"
JavaOptions="$(JavaOptions)"
ClassesOutputDirectory="$(IntermediateOutputPath)android\bin\classes"
ToolPath="$(DxToolPath)"
ToolExe="$(DxToolExe)"
UseDx="$(UseDx)"
MultiDexEnabled="$(AndroidEnableMultiDex)"
MultiDexMainDexListFile="$(_AndroidMainDexListFile)"
JavaLibrariesToCompile="#(_JavaLibrariesToCompileForAppDx)"
OptionalObfuscatedJarFile="$(IntermediateOutputPath)proguard\__proguard_output__.jar"
/>
The error occurs during the compilation process.
I have consulted these sources:
"https://developer.android.com/studio/build/multidex.html"
"http://www.jon-douglas.com/2016/09/05/xamarin-android-multidex/"
"http://www.jon-douglas.com/2016/09/23/xamarin-android-multidex-keep/"
"https://przemekraciborski.eu/"
"https://forums.xamarin.com/discussion/64234/multi-dex-app-with-a-custom-application-class-that-runs-on-pre-lollipop"
"http://frogermcs.github.io/MultiDex-solution-for-64k-limit-in-Dalvik/"
I also have the ClassyShark.jar tool, but no dex or apk file is generated to explore it. Only the mono.android.jar file exists
Please I need help.
Thank you very much.
Responding to answer 1 and Luke Pothier's commentary are the results:
Setting output verbosity = Diagnostic
Case 1:
Using Android Sdk Location: C:\Program Files (x86)\Android\android-sdk installed with Visual Studio 2015.
4>_CompileToDalvikWithDx:
4> Creating directory "obj\Debug\proguard".
4> C:\Program Files\Java\jdk1.8.0_121\\bin\java.exe -Xmx1G -jar "C:\Program Files (x86)\Android\android-sdk\build-tools\25.0.3\\lib\dx.jar" --no-strict --dex --output= ...
4> trouble writing output: Too many field references: 68102; max is 65536.
4> You may try using --multi-dex option.
4> References by package:
(list of references by packages)
4>C:\Program Files (x86)\MSBuild\Xamarin\Android\Xamarin.Android.Common.targets(1965,3): error MSB6006: "java.exe" exited with code 2.
Case 2:
Using Android Sdk Location: c:\android\sdk with last proguard version 5.3.3 installed with Android Studio.
4>_CompileToDalvikWithDx:
4> Creating directory "obj\Debug\proguard".
4> C:\Program Files\Java\jdk1.8.0_121\\bin\java.exe -Xmx1G -jar C:\Android\sdk\build-tools\25.0.0\\lib\dx.jar --no-strict --dex --output=
4> trouble writing output: Too many field references: 68102; max is 65536.
4> You may try using --multi-dex option.
4> References by package:
(list of references by packages)
4>C:\Program Files (x86)\MSBuild\Xamarin\Android\Xamarin.Android.Common.targets(1965,3): error MSB6006: "java.exe" exited with code 2.
This is likely to be caused by an issue between Xamarin and ProGuard, the fix to which is detailed here. Essentially, you need to replace the proguard.jar file that is in your Android SDK directory with the latest one from SourceForge (v5.3.3 currently).
EDIT: Per the error messages in your edits, the --multi-dex option isn't being passed during compilation. I would check your Android .csproj to make sure that the <AndroidEnableMultiDex> option is set to True for all build configurations. If that doesn't help, you may need to upload a reproducible sample somewhere.
EDIT 2: Per the comments, your Android SDK location needs to be somewhere where the path does not contain spaces. Program Files is no good. Personally I put mine in C:\Android\android-sdk.
After adjusting the path to the android sdk, removing the spaces and setting in the project file for the Droid platform the property AndroidEnableMultiDex in all configurations (appeared AndroidEnableMultipleDex) in true, I was able to compile without errors. Also, I have been able to check the contents of the generated dex files and both have references to Mvvmcross.
When I execute the application, it shows the splash view (ok!!!), but, an exception occurs when processing the view (activity) that has a binded viewmodel. Now, the viewmodel has null value. (Until the moment of having to activate the multidex, the application executed without any incidence)
My challenge now is to know if all the reference to Mvvmcross should be in the main dex, or is it due to another problem that I have overlooked?
Thanks in advance for his time to #LukePothier.
My self response:
After compiling and generate dex classes:
use dex2jar & jd-gui tools following Jon Douglas' hints in http://www.jon-douglas.com/2016/09/23/xamarin-android-multidex-keep/.
be very patient and persevere.
remove innesesary code and plugin if you can do it yourself.
I already have the application running !!!

Error: Abnormal build process termination in Android Studio 2.0

This week I updated Android Studio to version 2.0. There is a known issue concerning Gradle, so I added export _JAVA_OPTIONS="-Djava.net.preferIPv6Addresses=true" to my ~/.profile (on Ubuntu 15.10).
But now I get this error when compiling:
Error:Abnormal build process termination:
Picked up _JAVA_OPTIONS: -Djava.net.preferIPv6Addresses=true
Build process started. Classpath: /opt/android-studio/lib/jps-launcher.jar:/usr/lib/jvm/java-8-oracle/lib/tools.jar:/opt/android-studio/lib/optimizedFileManager.jar:/opt/android-studio/lib/ecj-4.4.jarError connecting to ::1:44484; reason: Protocol family unavailable: /0:0:0:0:0:0:0:1:44484
java.net.SocketException: Protocol family unavailable: /0:0:0:0:0:0:0:1:44484
at sun.nio.ch.Net.connect0(Native Method)
at sun.nio.ch.Net.connect(Net.java:454)
at sun.nio.ch.Net.connect(Net.java:446)
at sun.nio.ch.SocketChannelImpl.connect(SocketChannelImpl.java:648)
at io.netty.channel.socket.nio.NioSocketChannel.doConnect(NioSocketChannel.java:210)
at io.netty.channel.nio.AbstractNioChannel$AbstractNioUnsafe.connect(AbstractNioChannel.java:207)
at io.netty.channel.DefaultChannelPipeline$HeadContext.connect(DefaultChannelPipeline.java:1208)
at io.netty.channel.ChannelHandlerInvokerUtil.invokeConnectNow(ChannelHandlerInvokerUtil.java:117)
at io.netty.channel.DefaultChannelHandlerInvoker.invokeConnect(DefaultChannelHandlerInvoker.java:248)
at io.netty.channel.AbstractChannelHandlerContext.connect(AbstractChannelHandlerContext.java:218)
at io.netty.channel.ChannelOutboundHandlerAdapter.connect(ChannelOutboundHandlerAdapter.java:47)
at io.netty.channel.ChannelHandlerInvokerUtil.invokeConnectNow(ChannelHandlerInvokerUtil.java:117)
at io.netty.channel.DefaultChannelHandlerInvoker.invokeConnect(DefaultChannelHandlerInvoker.java:248)
at io.netty.channel.AbstractChannelHandlerContext.connect(AbstractChannelHandlerContext.java:218)
at io.netty.channel.ChannelOutboundHandlerAdapter.connect(ChannelOutboundHandlerAdapter.java:47)
at io.netty.channel.ChannelHandlerInvokerUtil.invokeConnectNow(ChannelHandlerInvokerUtil.java:117)
at io.netty.channel.DefaultChannelHandlerInvoker.invokeConnect(DefaultChannelHandlerInvoker.java:248)
at io.netty.channel.AbstractChannelHandlerContext.connect(AbstractChannelHandlerContext.java:218)
at io.netty.channel.AbstractChannelHandlerContext.connect(AbstractChannelHandlerContext.java:212)
What can I do?
Use the opposite flag _JAVA_OPTIONS = -Djava.net.preferIPv4Stack=true

Can't build streamer tutorial for android on mac

Can't build streamer tutorial_3 for android on mac
I,ve got all environment variables needed.
My eclipse can't to resolve some symbols, but to some of them i can get by pushing F3. It's very strange for me.
Here is the command line output:
23:04:06 **** Build of configuration Default for project Tutorial3 ****
/Users/antonivanuskin/android-develop/android-ndk-r10/ndk-build all
GStreamer : [GEN] => gst-build-armeabi/gstreamer_android.c
GStreamer : [COMPILE] => gst-build-armeabi/gstreamer_android.c
GStreamer : [LINK] => gst-build-armeabi/libgstreamer_android.so
lto1: fatal error: bytecode stream generated with LTO version 2.2 instead of the expected 3.0
compilation terminated.
lto-wrapper: /Users/antonivanuskin/android-develop/android-ndk-r10/toolchains/arm- linux-androideabi-4.9/prebuilt/darwin-x86_64/bin/arm-linux-androideabi-gcc returned 1 exit status
/Users/antonivanuskin/android-develop/android-ndk-r10/toolchains/arm-linux-androideabi-4.9/prebuilt/darwin-x86_64/bin/../lib/gcc/arm-linux-androideabi/4.9/../../../../arm-linux-androideabi/bin/ld.gold: fatal error: lto-wrapper failed
collect2: error: ld returned 1 exit status
make: *** [buildsharedlibrary_armeabi] Error 1
23:04:10 Build Finished (took 3s.740ms)*
I use ndk-10r and gst-1.4.0.
I know that there is no interfaces/xoverlay in new streamer.
EDIT
I've built ok, but steel got underlines of many glib-types and GST-macross. Here is a screenshot:
what is interesting that i have no underlined headers, for example: i've include pthread.h but have got underlined pthread_t and phtread_key_t....
i think that i have not install some general libraries on my mac, something like libc or what ever...may it couse this problem? The problem is that i can't run my app from eclipse. and for more: i use DS-5 CE IDE
This is most likely because we build the android 1.4.x cerbero packages with the r9d NDK.
You might want to use the r9d NDK until we provide binaries built with a more recent NDK (started some builds to see if everything goes through fine).

Jenkins unable to locate files on my computer

when ever I try to build my android project on jenkins it fails by saying :
Started by user anonymous
Building in workspace /home/tanzeelrana/git/eventmatrix-cordova-app/mysteryshopper_version2
[mysteryshopper_version2] $ ant -Dlabel=trial1-9 clean debug
Buildfile: /home/tanzeelrana/git/eventmatrix-cordova-app/mysteryshopper_version2/build.xml
BUILD FAILED
/home/tanzeelrana/git/eventmatrix-cordova-app/mysteryshopper_version2/build.xml:90: Cannot find /home/tanzeelrana/android-sdk-linux/tools/ant/build.xml imported from /home/tanzeelrana/git/eventmatrix-cordova-app/mysteryshopper_version2/build.xml
Total time: 0 seconds
Build step 'Invoke Ant' marked build as failure
Finished: FAILURE
on line 90 in my build.xml file I have a tag with the following in it :
import file="/home/tanzeelrana/android-sdk-linux/tools/ant/build.xml"
does anyone know why it is unable to locate this file ? the file exist at the exact path ....
Jenkins usually runs with its own user (jenkins),
so it is probably an issue of permissions.
Try printing the current user from within your Jenkins job.
EDIT:
See here about running Jenkins as a daemon -
it also shows how to set it to run as a different user than 'jenkins':
Installing Jenkins as a Unix daemon

Xamarin Studio 2 - latest stable update - Error executing task Aapt: The source sequence is empty

I am using the trial version of Xamarin Studio for my final year project consisting an android application. Everything went smooth initially. But today right after updating to the latest stable version, i encountered an error (as stated on the title of this post).
The build log is as follows:
Building Solution: MyActivity.Mobile (Debug)
Building: MCAAndroid (Debug)
Build started 05/18/2013 17:04:44.
Project
"/Users/hazimanabhmy/Projects/MyActivity.Mobile/MCAAndroid/MCAAndroid.csproj"
(Build target(s)):
Target _CheckProjectItems:
CheckProjectItems Task
NativeLibraries:
JavaLibraries:
JavaSourceFiles:
Target _ComputeAndroidAssetsPaths:
ResourceFiles:
Assets/WebUI/newsfeed.html
Assets/WebUI/images/bg_content.png
Assets/WebUI/css/style.css
Assets/WebUI/images/flag.png
IntermediateFiles:
Target _GenerateAndroidAssetsDir: Skipping target
"_GenerateAndroidAssetsDir" because its outputs are up-to-date.
Target _ComputeAndroidResourcePaths:
ResourceFiles:
Resources/values/Strings.xml
Resources/drawable/Icon.png
Resources/layout/Login.axml
Resources/drawable/le_cool_logo.png
Resources/drawable/bg.jpg
Resources/drawable/icon_password.png
Resources/drawable/Icon_user.png
Resources/layout/Home.axml
Resources/drawable/info.png
Resources/drawable/settings.png
Resources/drawable/help.png
Resources/drawable/bg_content.png
Resources/drawable/shadow_black.9.png
Resources/drawable/cog.png
Resources/drawable/tools.png
Resources/layout/ReadMatric.axml
Resources/drawable/matric.jpg
Resources/drawable/mcalogo.png
IntermediateFiles:
Target _GenerateAndroidResourceDir: Skipping target
"_GenerateAndroidResourceDir" because its outputs are up-to-date.
Target _ResolveMonoAndroidSdks:
MonoAndroid Tools: /Library/Frameworks/Xamarin.Android.framework/Versions/Current/lib/mandroid/
MonoAndroid Framework: /Library/Frameworks/Xamarin.Android.framework/Versions/Current/lib/mandroid/platforms/android-10;/Library/Frameworks/Xamarin.Android.framework/Versions/Current/lib/mono/2.1
MonoAndroid Binaries: /Library/Frameworks/Xamarin.Android.framework/Versions/Current/bin/
Android NDK:
Android SDK: /Users/hazimanabhmy/Library/Developer/Xamarin/android-sdk-mac_x86/
Java SDK: /usr/
Target _ValidateAndroidPackageProperties:
GetAndroidPackageName Task
ManifestFile: /Users/hazimanabhmy/Projects/MyActivity.Mobile/MCAAndroid/Properties/AndroidManifest.xml
AssemblyName: MCAAndroid
PackageName: MCAAndroid.MCAAndroid
Target _BuildDependencies:
Resolved library outputs:
Target _ExtractLibraryProjectImports:
Assemblies:
/Library/Frameworks/Xamarin.Android.framework/Versions/Current/lib/mono/2.1/System.dll
/Library/Frameworks/Xamarin.Android.framework/Versions/Current/lib/mono/2.1/System.Xml.dll
/Library/Frameworks/Xamarin.Android.framework/Versions/Current/lib/mandroid/platforms/android-10/Mono.Android.dll
/Library/Frameworks/Xamarin.Android.framework/Versions/Current/lib/mono/2.1/System.Core.dll
Jars:
ResolvedResourceDirectories:
Target _GetLibraryImports:
NativeLibraries:
Jars:
Target _CheckDuplicateJavaLibraries:
JavaSourceFiles:
JavaLibraries:
Target _UpdateAndroidResgen:
AdditionalResourceDirectories: /Library/Frameworks/Mono.framework/External/xbuild/Xamarin/Android/Xamarin.Android.Common.targets:
error : Error executing task Aapt: The source sequence is empty Task
"Aapt" execution -- FAILED Done building target "_UpdateAndroidResgen"
in project
"/Users/hazimanabhmy/Projects/MyActivity.Mobile/MCAAndroid/MCAAndroid.csproj".--
FAILED
Done building project
"/Users/hazimanabhmy/Projects/MyActivity.Mobile/MCAAndroid/MCAAndroid.csproj".--
FAILED
Build FAILED. Errors:
/Users/hazimanabhmy/Projects/MyActivity.Mobile/MCAAndroid/MCAAndroid.csproj
(Build) ->
/Library/Frameworks/Mono.framework/External/xbuild/Xamarin/Android/Xamarin.Android.Common.targets
(_UpdateAndroidResgen target) ->
/Library/Frameworks/Mono.framework/External/xbuild/Xamarin/Android/Xamarin.Android.Common.targets:
error : Error executing task Aapt: The source sequence is empty
0 Warning(s) 1 Error(s) Time Elapsed 00:00:00.1048310
---------------------- Done ----------------------
Build: 1 error, 0 warnings
I couldn't find the cause. Would someone help me?
I have asked this same question on Xamarin.Android's forum, and still waiting for their answer. But i think i could gather more resources and insights from experts here.
It's a recent change/bug in Xamarin.Android that expects to be used with Android tools rev. 22 or later where appt has been moved around in the sdk directory (from tools to build-tools). You need to go into the android sdk manager and update the SDK tools to revision 22 (or better) and also install the new build-tools package.

Categories

Resources