I get the following error, but when I increase the Max Heap Size, it doesn't have any effect. I have gone up to 8G with no change. Is there something else going on?
Suppression State
Error java.lang.OutOfMemoryError. Consider increasing the value of $(JavaMaximumHeapSize). Java ran out of memory while executing 'java.exe -Xmx1G -jar "C:\Program Files (x86)\Android\android-sdk\build-tools\28.0.0-rc1\lib\dx.jar" --dex --no-strict --output obj\Debug\android\bin "C:\code\Droid\obj\Debug\android\bin\classes.zip" "C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\Common7\IDE\ReferenceAssemblies\Microsoft\Framework\MonoAndroid\v8.0\mono.android.jar" obj\Debug\lp\10\jl\bin\classes.jar obj\Debug\lp\11\jl\bin\classes.jar obj\Debug\lp\12\jl\bin\classes.jar obj\Debug\lp\13\jl\bin\classes.jar obj\Debug\lp\14\jl\bin\classes.jar obj\Debug\lp\15\jl\bin\classes.jar obj\Debug\lp\16\jl\bin\classes.jar obj\Debug\lp\17\jl\bin\classes.jar obj\Debug\lp\18\jl\bin\classes.jar obj\Debug\lp\19\jl\classes.jar obj\Debug\lp\20\jl\classes.jar obj\Debug\lp\21\jl\classes.jar obj\Debug\lp\22\jl\classes.jar obj\Debug\lp\3\jl\arch-core-common.jar obj\Debug\lp\4\jl\arch-lifecycle-common.jar obj\Debug\lp\5\jl\bin\classes.jar obj\Debug\lp\6\jl\bin\classes.jar obj\Debug\lp\8\jl\bin\classes.jar obj\Debug\lp\9\jl\bin\classes.jar'
Delete bin and object files. If you are using Mac i would recommend adding nice plugin:
enter link description here
Related
I'm building c++ application for android using Android Studio 2.3.3. Build fails with error:
Fatal error: can't create
CMakeFiles/kore.dir/C_/ab/android-native-build/Sources/src/banan/server/serverData/ServerCompound_banan_server_serverdata_ListValue_IdInt_banan_server_serverdata_ServerCompound_serverdata_ServerAchieve.cpp.o:
No such file or directory clang++.exe: error: assembler command failed
with exit code 1 (use -v to see invocation)
The directory in which this file should be created exists and some other files were successfully created there.
I think this is because of path is too long. I've seen such messages previously and moving project to another directory with shorter path have solved the issue. But now I've already done this.
shorter your project location because path maximum 256 char long is accepted.
I want to use dx tool. So I use the following command in terminal
dx --dex --output=classes.dex sample.jar
and I got this error
No such file or directory
I know i should set environment variable "path" and add /build-tools/x.y.z/dx to it. But even set the path doesn't resolve the error. I should mention that I can run it from /build-tools/x.y.z/ by running the command
./dx
but i need to access dx from any directory, for my project purpose. I use ubuntu 14.04 64 bit. How can I fix it?
I Want to build apk using commandline, I am using ant server by using it I am building apk with commandline but when I give this command ant debug it shows error BUILD FAILED Unable to locate tools.jar and then it gives error source resource doesnt exist
This might be because your JAVA_HOME is not set to your C:\Program Files\Java\jdk folder.
instead it might be set to C:\Program Files\Java\jre so it's not getting tools.jar.
just check out this.
You can do this in this way:
C:\>set JAVA_HOME=C:\Program Files\Java\jdk
C:\>ant debug
You need tools.jar file from your jdk/lib/ folder.
I have a mono android project. I can use monodevelop to build the apk of my project. But I want to write a build file (like we do using ANT) with targets that can generate the .apk file.
Please point me to the right direction.
I have figured out the we need to use mandroid.exe to generate .apk from the .dll.
the log shows that there is a target called _Manddroid that monodevelop's build tool runs. This target in turn runs following command
C:\Program Files\MSBuild\Novell\mandroid.exe -v --nosign --sdk-dir="C:\Android\android-sdk" --builddir="C:\Users\Sikha\Documents\Projects\helloShikha\helloShikha\obj\Debug\android" --framework-dir="C:\Program Files\Reference Assemblies\Microsoft\Framework\MonoAndroid\v2.2" --framework-dir="C:\Program Files\Reference Assemblies\Microsoft\Framework\MonoAndroid\v1.0" -S="C:\Users\Sikha\Documents\Projects\helloShikha\helloShikha\obj\Debug\res" --package="helloShikha.helloShikha" --nolink --abi="armeabi" --java-sdk-dir="C:\Program Files\Java\jdk1.6.0_30" --debug --sdk-platform="8" "C:\Users\Sikha\Documents\Projects\helloShikha\helloShikha\bin\Debug\helloShikha.dll" "C:\Program Files\Reference Assemblies\Microsoft\Framework\MonoAndroid\v2.2\Mono.Android.dll" "C:\Program Files\Reference Assemblies\Microsoft\Framework\MonoAndroid\v1.0\mscorlib.dll" "C:\Program Files\Reference Assemblies\Microsoft\Framework\MonoAndroid\v1.0\System.Core.dll" "C:\Program Files\Reference Assemblies\Microsoft\Framework\MonoAndroid\v1.0\System.dll" "C:\Program Files\Reference Assemblies\Microsoft\Framework\MonoAndroid\v1.0\System.Xml.dll"
When I try to copy paste the above command on cmd nothing happens. Any Idea what I am missing here?
I used following command and it generated the .apk file for me.
C:\Windows\Microsoft.NET\Framework\v4.0.30319\MSBuild.exe myproject.csproj /t:Package
I tried using .sln file but was receiving an error : target Package does not exist in the project.
I opened the myproject.csproj file and figured out that this file imports Novell.MomoDroid.CSharp.Targets which in turn imports the Novell.MonoDroid.Common.Targets
The target "Package" is present in the file Novell.MonoDroid.Common.Targets.
Why do you want to write alternative targets? The Mono for Android project files are MSBuild-based, and MSBuild is Microsoft's equivalent of ant. This means the csproj files are already fully extensible and customizable, and can be built using the commandline MSBuild tool:
C:\Windows\Microsoft.NET\Framework\v4.0.30319\MSBuild.exe YourSolution.sln
I have a kind of strange issue. In my bash script or Makefile, using aapt with absolute path does not work but if I am in the local directory it does.
If I do the following, it does not work:
aapt add $OUT/device.jar $OUT/classes.dex
The command does run and print this output:
'/homes/rsevile/CS307/bin/Device/classes.dex'...
But when trying to load the jar, the class that I am trying to load end up being not found.
The following does work though:
cd $OUT
aapt add device.jar classes.dex
Printing:
'classes.dex'...
This is the whole code being executed in the script (which works):
javac -d $(OUT)/classes -classpath ./layoutlib.jar src/com/device/client/*.java
jar cf $(OUT)/device.jar $(OUT)/classes $(OUT)/layoutlib
dx --dex --no-strict --output=$OUT/classes.dex $OUT/device.jar
cd $OUT
aapt add device.jar classes.dex
cd $ROOT
adb push $OUT/device.jar $ANDROID_OUT_DIR
I am confused why my class ends up being not found when using an absolute path with aapt.
Could anyone please explain to me why it is not working and how I could fix it to use a proper absolute path please?
Thank you.
I realized that aapt actually keeps the absolute path, there is no way around it.
I fixed the problem by reusing jar and using the -C option that lets me specify a directory.