android studio doesnt build cannot run program - android

After creating a new project, I met the following error:
java.io.IOException: Cannot run program "C:\NVPACK\android-sdk-windows\build-tools\build-tools-22.0.1\aapt.exe": CreateProcess error=193, %1 is not a valid Win32 application
at java.lang.ProcessBuilder.start(ProcessBuilder.java:1047)
at com.android.builder.png.AaptProcess$Builder.start(AaptProcess.java:154)
at com.android.builder.png.QueuedCruncher$1.creation(QueuedCruncher.java:105)
at com.android.builder.tasks.WorkQueue.run(WorkQueue.java:206)
I read that it can be beacuse of the space in the file path. But the path does not contain any spaces. How to fix it?

I suggest that you can replace '-' with '_' or just don't use '-'.

I once have same problem.
solved it by change the "Android SDK Build Tool" version 18.0.2 to 18.0.1 .
upgrade or downgrade "Android SDK Build Tool" version may solve it as me.
File-> Settings

Related

Compile error after update Android Studio to 4.2

Today, after update Android studio to version 4.2, i often get this errors, when i'm compiling my project:
Execution failed for task ':app:compileLocalmfcDebugKotlin'.
java.io.IOException: Cannot run program "C:\Program Files\Android\Android Studio\jre\bin\java": CreateProcess error=206,
��� ����� ��� ��� ���������� ����� ������� ������� �����
CreateProcess error=206, The filename or extension is too long at.
I think after upgrading to Androi's Studio 4.2, you can do the following:
File -> Invalidate caches/Restart
If you are using Kotlin 1.5, you need to check whether the version of the Kotlin plugin is 1.5
For possible reasons of Gradle, you can delete the corresponding directory of Android Studio Gradle, and then recompile.
It may be the reason of your code itself, please check

Error when compiling with Gradle (can't find downloaded dependencies)

I develop an app generation system that is regenerating apps by command line Gradle compilation commands.
In my Windows Server 2008, I'm facing a problem after updating to the last Gradle version and Gradle plugin version.
When compiling I'm getting this errors:
C:\Windows\System32\config\systemprofile\.gradle\caches\transforms-1\files-1.1\appcompat-v7-25.0.0.aar\e93435c34d5cae8b6677dcef529711a5\res\drawable-xxhdpi-v4\abc_text_select_handle_middle_mtrl_light.png: error: file not found.
C:\Windows\System32\config\systemprofile\.gradle\caches\transforms-1\files-1.1\appcompat-v7-25.0.0.aar\e93435c34d5cae8b6677dcef529711a5\res\drawable\abc_btn_colored_material.xml: error: file not found.
C:\Windows\System32\config\systemprofile\.gradle\caches\transforms-1\files-1.1\appcompat-v7-25.0.0.aar\e93435c34d5cae8b6677dcef529711a5\res\drawable-hdpi-v4\abc_textfield_search_default_mtrl_alpha.9.png: error: file not found.
and a lot more of errors like those...
I'm not sure why I'm getting this error, because the file is correctly downloaded and it's correctly located on that exactly direction.
It has a path length of 204 characters, so supposedly it's not surpassing the limit of 255 path characters on NTFS Windows file system.
It is possible to change the location where Gradle downloads it's cached dependencies? Is this problem caused by this or by other thing?
finally i solved this setting the environmental variable GRADLE_USER_HOME in windows to c:/gradle-cache
so definitively it's related to file path lenght
I meet this same error in windows jenkins
I solved this error.
gradle assembleDebug -g C:\gradle-cache
-g:
gradle -h
-g, --gradle-user-home Specifies the gradle user home directory
Path length cause failure.
I defined
"-Dorg.gradle.user.home=%GRADLE_USER_HOME%"
in gradle run parameters and it solved the problem.

The specified task executable location ... is invalid

I'm new to Xamarin. I'm having a problem with deployment. The project builds successfully but then I get an error message:
C:\Program Files
(x86)\MSBuild\Xamarin\Android\Xamarin.Android.Common.targets(2,2):
Error MSB6004: The specified task executable location
"C:\android\sdk\tools\zipalign.exe" is invalid. (MSB6004) (FirstApp)
". " Deployment failed. Packaging failed ".
I'm not sure what the problem is or what to do to resolve this. Please help.
Because of a new Android version, the zipalign got switched from directory. See over here
Currently, I saw they updated Xamarin with a fix for this. You should try to update Xamarin first. Version 5.1.2 fixes this: "Fixes a regression introduced by Android SDK Tools r23 and Android Build-tools r20 that changed the path of the zipalign tool."
This solution just worked for me:
You need to copy
C:\Program Files (x86)\Android\android-sdk\build-tools\19.1.0\zipalign.exe
not in
C:\Program Files (x86)\Android\android-sdk\tools
but in
C:\Users\yourfolder\AppData\Local\Android\android-sdk\tools
Also see:
ApkClean 0.9.02
https://code.google.com/p/apkclean/downloads/detail?name=ApkClean-0.9.02.zip&can=2&q=
:)

Android dex gives a BufferOverflowException when building

When compiling a specific Android project, and only on my Windows machine, I get a java.nio.BufferOverflowException during from dex. The problem occurs both when using Eclipse and when using Ant.
The output when using Ant is:
...
[dex] Pre-Dexing C:\MyProject\libs\android-support-v4.jar -> android-support-v4-5f5341d3c1b10a79d7d93f9c1e64421e.jar
[dex] Converting compiled files and external libraries into C:\MyProject\bin\classes.dex...
[dx]
[dx] UNEXPECTED TOP-LEVEL EXCEPTION:
[dx] java.nio.BufferOverflowException
[dx] at java.nio.Buffer.nextPutIndex(Buffer.java:499)
[dx] at java.nio.HeapByteBuffer.putShort(HeapByteBuffer.java:296)
[dx] at com.android.dex.Dex$Section.writeShort(Dex.java:818)
[dx] at com.android.dex.Dex$Section.writeTypeList(Dex.java:870)
[dx] at com.android.dx.merge.DexMerger$3.write(DexMerger.java:437)
[dx] at com.android.dx.merge.DexMerger$3.write(DexMerger.java:423)
[dx] at com.android.dx.merge.DexMerger$IdMerger.mergeUnsorted(DexMerger.java:317)
[dx] at com.android.dx.merge.DexMerger.mergeTypeLists(DexMerger.java:423)
[dx] at com.android.dx.merge.DexMerger.mergeDexes(DexMerger.java:163)
[dx] at com.android.dx.merge.DexMerger.merge(DexMerger.java:187)
[dx] at com.android.dx.command.dexer.Main.mergeLibraryDexBuffers(Main.java:439)
[dx] at com.android.dx.command.dexer.Main.runMonoDex(Main.java:287)
[dx] at com.android.dx.command.dexer.Main.run(Main.java:230)
[dx] at com.android.dx.command.dexer.Main.main(Main.java:199)
[dx] at com.android.dx.command.Main.main(Main.java:103)
BUILD FAILED
C:\Users\Jaap\android-sdks\tools\ant\build.xml:892: The following error occurred while executing this line:
C:\Users\Jaap\android-sdks\tools\ant\build.xml:894: The following error occurred while executing this line:
C:\Users\Jaap\android-sdks\tools\ant\build.xml:906: The following error occurred while executing this line:
C:\Users\Jaap\android-sdks\tools\ant\build.xml:284: null returned: 2
When using Eclipse the message is shorter but similar:
[2013-11-01 14:29:44] APK file is not created for Project:
[2013-11-01 14:29:46 - Dex Loader] Unable to execute dex: java.nio.BufferOverflowException. Check the Eclipse log for stack trace.
[2013-11-01 14:29:46 - MyProject] Conversion to Dalvik format failed: Unable to execute dex: java.nio.BufferOverflowException. Check the Eclipse log for stack trace.
Like I said, I don't have this problem on my MacBook, even though they are both upgraded to the latest versions of the Android Build tools: 19.0.0.
No need to downgrade the build tools back to 18.1.11, this issue is fixed with build tools 19.0.1.
If you can't use 19.0.1 for some reason then:
Make sure that the value of android:targetSdkVersion in AndroidManifest.xml matches target=android-<value> in project.properties. If these two values are not the same, building with build tools version 19.0.0 will end in the BufferOverflowException. Source
There is also some indication from comments on this post that you need to target at least 19 (android-19). Please leave a comment if this solution also works if your target is < 19.
This is how the fix looks for my project. The related AOSP issue is #61710.
1 If you really need to downgrade, you don't need to uninstall build tools 19.0.0, simply install 18.1.1 and add sdk.buildtools=18.1.1 to the local.properties file.
Try what van said:
Right click your project → android tools → android support library.
Same problem here. Reverted to build tools 18.1.1, restarted Eclipse and that fixed it.
I was able to get my problem project to build by adding this extra line:
sdk.build.tools=18.1.1
...to my project.properties file, which is present in the root of the project folder. All other approaches seemed to fail for me.
Right click on project >> Properties >> Android >> API Level 18 worked for me. But before I did that I did right click on project >> Android Tools >> Add Support Library and restarted Eclipse. You may have to play around with your selected API level.
After the installation of the new SDK, there is a new folder, "Android Dependencies", under your project file. If you right click and remove it from the build path, you will again be able to build your project.
Update
right click your project > android tools > android support library
Clean your project and try to built.
I had the same problem after updating to Revision 19. Just do not forget to update ADT, https://dl-ssl.google.com/android/eclipse/. After this, I was able to build project with the latest revision.
I fixed this problem without downloading the support library or reverting the build tools to 18.1.1.
I simply changed the API level to 16+ and the problem vanished. Hope it will help.
None of the other solutions here worked for me after upgrading to Android Studio 0.4.0 and Gradle 1.9.
I resolved the problem by downloading Build Tools 19.0.1 and updating the following line in my build.gradle files:
buildToolsVersion '19.0.0'
to
buildToolsVersion '19.0.1'
For the ones facing issue with IntelliJ IDEA 13, uninstall Build Tools 19.
Had the same issue with target version 19 on both project.properties and AndroidManifest.xml with Ant.
Fixed it by:
Uninstalled Android SDK Build-Tools 19.0.1
Installed Android SDK Build-Tools 19.0.2
I think #Al-Kathiri-Khalid is spot on. The issue is only due to missing support for the API level in Build Tools.
I had the same problem, though my project did not use the support library. Adding libs/android-support-v4.jar to the project worked around the problem without needing to revert the build tools back from v19.
I solved this problem. Just make this change in the project properties file:
target=android-18
sdk.build.tools=18.1.1
And in the manifest file:
uses-sdk android:minSdkVersion="8"
android:targetSdkVersion="18"
Add the Library file in project..
Project->right click->Properties->android->Library-> click Add and select the Library Project and give apply and ok..
then, clean the project and run again.. if you want restart the eclipse..
And also, sometimes, need to update Android SDK build tools..
What worked for me was this:
I opened the project.properties file from the root of my project and changed target=android-8 to target=android-17
java.nio.BufferOverflowException during from dex error
This means you don't have the supporting API for that level hence the build fails, there are a number of ways you can fix this.
Check your manifest file uses-sdk android:minSdkVersion="4" and android:targetSdkVersion="14"
Any of the below will fix the problem:-
Download the required API level (This might take time) and run your application again
Quick dirty fix change your Project target in project.properties
to your new target target=android-4
Quick clean fix, change the SdkVersion in your manifest and Clean
your project to add the changes to your project.properties (My favorite)
I removed the previous Android SDK and Eclipse. I installed the ADT bundle and it works...
This fixed the problem of BufferOverflow on Dex that started after I got API 19. I was previously using Eclipse with Android SDK installed as an add-on package.
Right click on Project>>Properties>>Android and select API Level greater than 15
OR
Add google-play-services_lib to your project by right clicking on project and selecting Project>>Properties>>Android>>Add

Got "Error running Integrated External Tool Builder" while setting up SWIG Builder for PocketSphinxAndroidDemo

Im setting up the PocketSphinxAndroidDemo in my Eclipse. I followed the instruction here: https://sites.google.com/site/opiatefuchs/home/pocketsphinxandroiddemo. In step 9, in the SWIG part its says there that "Don´t change anything in the "Main"-Tab" but an error message pop out of my eclipse "The file does not exist for the external tool named SWIG". So i change the path to C:\Users\beautifulJeazel\Documents\Project\CMUSphinx\PocketSphinxAndroidDemo.externalToolBuilders\SWIG.Launch.
After applying the changes I got this error :
Errors occurred during the build.
Errors running builder 'Integrated External Tool Builder' on project 'PocketSphinxDemo'.
Exception occurred executing command line.
Cannot run program "C:\Users\beautifulJeazel\Documents\Project\CMUSphinx\PocketSphinxAndroidDemo.externalToolBuilders\SWIG.launch" (in directory "C:\Users\beautifulJeazel\Documents\Project\CMUSphinx\PocketSphinxAndroidDemo\jni"): CreateProcess error=193, %1 is not a valid Win32 application
Exception occurred executing command line.
Cannot run program "C:\Users\beautifulJeazel\Documents\Project\CMUSphinx\PocketSphinxAndroidDemo.externalToolBuilders\SWIG.launch" (in directory "C:\Users\beautifulJeazel\Documents\Project\CMUSphinx\PocketSphinxAndroidDemo\jni"): CreateProcess error=193, %1 is not a valid Win32 application
I dont know, what seems to be the problem. I path the swig in the Environment Variables just what the tutorial says but i can't seem to make it work. I tried googling it but i can't find a definite answer for my problem.. I hope u can help with this.
im using swig-1.3.34, eclipse juno and android ndk r9
Select your project and right click Properties->Builders.
Select the offending builder and remove it.
For easiest build you can just check precompiled version from
https://svn.code.sf.net/p/cmusphinx/code/trunk/pocketsphinx-android-demo
It is new updated version with new features which doesn't require SWIG and works just with importing the project.
For information about it please see the updated tutorial
http://cmusphinx.sourceforge.net/wiki/tutorialandroid

Categories

Resources