What happened to Android AAPT? - java

I downloaded the most recent version of Android for Linux (android-sdk_r05-linux_86.tgz). I was trying to use the the Android Ant task(s) for packaging, building, and deploying my code. I should mention that I'm running AMD64, but I have the 32-bit libraries installed. The Android Ant tasks are all broken.
First, the start-emulator task never gets the emulator running. It does get past starting adb, but then it just sits there.
Second, the SDK is missing the AAPT binary in the tools directory. So, the example notepad sample application will not even package correctly.
java.lang.IllegalStateException: Can't find aapt inside the sdk at /home/user/bin/android-sdk-linux_86
at com.googlecode.autoandroid.lib.AndroidTools.locateTool(AndroidTools.java:116)
at com.googlecode.autoandroid.lib.AndroidTools.startTool(AndroidTools.java:103)
at com.googlecode.autoandroid.lib.AndroidTools.startTool(AndroidTools.java:91)
at com.googlecode.autoandroid.lib.UnixAndroidTools.aapt(UnixAndroidTools.java:9)
I have all the dependencies configured for Android. I can run it from the command line just fine.
I assume the Ant code is out of sync with the recent SDK updates. Can anyone shed some light on this problem? At this point, I'm considering writing my own Python scripts to interact with the Android SDK. Ugh.

For anyone running into this recently, aapt moved again. It's now in $ANDROID_SDK/build-tools/17.0.0.

I have written three books all using the Android Ant build scripts. Trust me, they work.
First, the start-emulator task never
gets the emulator running. It does get
past starting adb, but then just sits
there.
Run the android command and launch the emulator from AVD Manager window that appears. AFAIK, there is no start-emulator task in Ant -- in fact, I'm not aware that there ever has been one.
Second, the SDK is missing the aapt
binary in the tools directory.
If you are looking in $ANDROID_HOME/tools/ (where $ANDROID_HOME is where you unpacked the SDK), you aren't supposed to find aapt there. That directory is for tools that directly support all API levels. API-level-specific tools, like aapt, will reside in $ANDROID_HOME/platforms/$SDK/tools/ (where $SDK is the name of some Android version, like android-2.1).
If you do not have anything in $ANDROID_HOME/platforms/, please follow step 4 of the installation instructions.

Related

Ndk-bundle linking cxx failed with clang++ (structure core)

I will try to explain my problem.
For two days I have been struggling with errors popping up during the process of building an android application.
I need to make an Android project for the Structure Core device, the manufacturer has put on his website a sample program and environment for which the scanner works, which I have uploaded to my cloud:
https://1drv.ms/u/s!AoHG6AtGqj2_g0eyFYMyh2uUNJUQ?e=aBpG1T
It's all about the build process itself which will allow me to open this project in Android Studio.
I do everything as in the instructions, but after executing the instructions, I get such an error and I have no idea what caused it. After installing ndk-bundle via SDK Manager, I had an ndk folder in AppData / Local / Android / Sdk, and the console asked for the ndk-bundle folder, so I just changed the name, I don't know if it was a problem, although I didn't find another solution.
At the moment I am working on a Windows generated environment and works good but i have to get an acces to Android App.
Ask if you could try to compile it on your own and possibly send me your ndk-bundle file or tell me what's wrong here.
Stucture Core notes that it is best to use ndk 21.01 and jdk11.
I tried to do this with a lot variation of java version.

Debugging Java Plugin in Ionic Framework application

I'm working on a Ionic Application and there are a few bugs on Custom Java Plugin imported to the app.
I'm not a Java developer but I wish to understand what happen in those plugins while I run the Ionic Application.
Looking on Google I found a few things like adb logcat that is something terrible and impossible to read.
I tried creating a few messages in the Java Plugin in this way:
Log.d("MyMessage", "Something is happening");
And using grep in the adb logcat to see only my messages but unfortunately it is not enough even because I can not pass a variable as message... so I don't exactly know what is going on in the Plugin while using the app.
I know about JDB but I don't know how to run it together with the Ionic App.
Basically I just wish to create breakpoints or to print dynamic variables while the Plugin is executed to understand where are bugs but I can not find anything useful.
I'm a Javascript developer and I have several tools to debug my Front-End stuff so I think it is quite weird it doesn't exist a way to debug much more complex, back-end, code...
I hope you can help me to do that.
For those still looking for a solution:
You can debug java plugins with Android studio and an Android emulator.
Step 1:
Install Android studio and SDK tools.
Step 2: Get a virtual device running. In order to use the emulator you need to have the Intel x86 emulator accelerator installed. I personally had issues here, I had to disable Hyper-V before it would run. This and other solutions can be found here: The intel x86 emulator accelerator (HAXM installer) revision 6.0.5 is showing not compatible with windows.
Step 3: Do a build for Android in your Ionic project (if you haven't already done so)
Step 4: Navigate to
File > New > Import Project and then navigate to your Ionic project. Don't import the entire project, just the Android folder ( {ProjectName} > platforms > android)
*WARNING: Don't update the gradle if you are presented with the option to do so. This may break the ability to build Android from within the Ionic folder. *
Not updating the gradle may result in a "Gradle project sync failed" error. In my case the solution was to run File -> Invalidate caches / Restart
And that's pretty much it. Once the project is loaded you can use the project tab to navigate to the plugin you want to debug, place breakpoints where you want them, and run debug.

Totally manual Android compile

I have always used ADT to develop Android applications, but have moved to a new machine which does not have ADT installed. Google does not seem to support using ADT any more anyway, saying "you should migrate your app development projects to Android Studio as soon as possible". But Android Studio apparently uses Gradle which requires an Internet connection to compile, which won't work for me when I'm on the road, when I can download stuff to install if needed, but don't have an Internet connection when I'm actually working.
So as a work-around I am exploring the idea of not using an IDE at all and just manually compiling everything. (This also seems more future proof against the next time Google decides everyone needs to switch to a whole set of new tools.) I assume that to do this I need a few command line tools, for instance, something like "javac" to compile Java files into class files and next something to create dex file(s) and finally something to package everything together into an apk and sign it. However, when I search for instructions on manual builds I still find constant references to a build system such as Ant or Gradle. I don't want to use any build system!
From scratch, what is the minimum I need in terms of tools I need to download and figure out the command line invocation to turn a simple (let's say "Hello World" simple) java file (and a few support files like a layout XML file and manifest) into a working APK? (Note that I need to build an APK that will work on APIs as old as API level 10.)
Update: Ok, so far I have installed the standalone SDK tools, and have used the SDK Manager to install the SDKs that I need. But now I'm unsure of what commands I need to run: I'm familiar with javac and I see that, but I know there are other commands too. Again, I have seen several SO questions asking about how to build and it refers to things like the ant or android command, which are NOT in the stand-along SDK tools and which shouldn't be necessary if I just knew which commands to invoke manually.

JavaFX on android - Hello world keeps crashing

So I read that you can get JavaFX applications to run on Android by using the Dalvik JavaFX-Android SDK (provided by the JavaFX Android porting team) and decided to try my hand at it.
After installing the Dalvik SDK and telling it where my Android SDK is, I tried to run the sample Hello World application that comes with the Dalvik SDK. So I went into the Hello World app's folder and ran the "gradlew installdebug" command. It all went well:
(source: forumbilder.se)
But when I tried launching the application on my phone it did not go so well:
(source: forumbilder.se)
Is there anyone of you that could provide an answer or maybe some speculation as to why it won't run?
Error message from Logcat:
(source: forumbilder.se)
(While the problem is already solved and the application is working, this is the solution, in case anyone faces the same problem)
Once android-sdk is installed, and once you download the dalvik package (dalvik-sdk-8u40-ea3 or new releases), to create the apk for the samples in that package, it's required to update a file named local.properties for each sample.
This file should contain the path to android sdk and to dalvik-sdk.
Then, from command line gradlew installDebug will create the apk and install it on the device.
Also, it comes in handy logging the messages from the device, not only in case the app crashes but also in case of unexpected behavior, or to check any System.out.println().
For that, from < android-sdk path >/platform-utils running on the command line
adb shell logcat
will log the app (and others from the device).

Unable to start Gradle deamon in fresh install of Android Studio 0.8.1

I wanted to start some Android app development with my friend recently. I've installed the latest Android Studio 0.8.1 and cloned github repo. Then, when I try to build the project using Gradle, it is failing with the message:
Caused by: org.gradle.api.GradleException: Unable to start the daemon process.
This problem might be caused by incorrect configuration of the daemon.
For example, an unrecognized jvm option is used.
Please refer to the user guide chapter on the daemon at http://gradle.org/docs/1.12/userguide/gradle_daemon.html
I am using Windows 8.1 64bit, JDK jdk1.7.0_60 64bit and gradle 1.12
I tried to:
- disable firewall and antivirus - didn't help
- download gradle manually, unzip and copy to .gradle in my home directory - didn't help
- when I open a blank new app I have same problem
- I moved the app to different directory as my user name contains 'ł' - same issue
Can anyone look at the log and try to help? This is the most annoying kind of issues developer can face - env is refusing to work and you can't code :(
<<< link to log >>>
Finally, after quite long fight last night, I have managed to run Android studio and build project with Gradle... and I hope it will stay so.
So, as #Eugen pointed out, this could be related to the fact that first installation of Android Studio was done for "only current user". Even I have uninstalled it and installed again it was still failing. Last night, I decided to uninstall it and also, manually, remove all remains of android stuff by simply deleting every directory with android, gradle etc. in its name ;)
I have also updated java to 7.65. and installed stand alone Gradle 2.0 and add it to PATH and check it is working.
After that, I done a clean install of android studio and open simple new MyApp project... and it works! Then I opened my other project - also working! I removed Gradle from PATH - still working.
I have no idea what was wrong... probably first installation of Android Studio was not completely correct. And unistalling it, didn't removed everything.
So, I have no clear answer for my issues, but I thought it could be helpful to describe the story. :)

Categories