AIDL files not building in Eclipse in random projects? - android

I've got some AIDL files which I want to include in a project, however Eclipse seems to work differently on different projects.
I'm developing an SDK for an application, and in the SDK android project the AIDL file generates the correct .java file, but in the main application Eclipse is not even attempting to build it.
Update: I found a log file and it says this:
!ENTRY com.android.ide.eclipse.adt 4 0 2012-04-21 19:22:11.043
!MESSAGE Failed to run one of the source processor
!STACK 0
java.lang.NullPointerException
at com.android.ide.eclipse.adt.internal.build.AidlProcessor.doCompileFiles(AidlProcessor.java:109)
(include rest of stack here...)
Joe

I had this exact issue happen to me today. It turns out this happens when there are source folders in your project that do not actually exist.
So verify in your project Java Build Path that all source folders actually exist. After removing a dead source folder link from there my project once again compiled the aidl.

From my experience you create the .aidl file in your project (make sure your included packages are correct - you will get an error if not). If the .aidl file is good a .java file will be created in the gen/ directory under the correct package name.
Next you must connect your java code to the interface using
<YourAidlClassName>.Stub myAidlInterface = new <YouAidlClassName>.Stub() {
// Your AIDL interface methods will appear in here and can now be used
// in your application as myAidlInterface.methodName();
}
Hope this helps.

Okay, I don't understand this but for some reason 12.04 of ubuntu flagged up an error.
On one project I could called the file IAPPNAMEConect.aidl but the other wanted it as IAPPNAMEService.aidl
I completely forgot about Java's strictness there

Related

How to set the local cpp source path in Android studio for prebuild library

I created an App which includes our source code as a native lib (so-file). I'm able to step into it and everything works fine so far with this code.
This native lib links against another native lib which was pre-build on a different machine and which I copied into the jni-abi-folder. I have checked out the svn-repository of this so-file in a different folder parallel to my project and need to be able to debug also into it.
When I now do a break, I can see the method names in the callstack so I assume that the symbols can be loaded, but Android Studio doesn't know where to find the source files.
Under Visual Studio, when I did a break, I could specify the symbols in the symbol path and then an error was displaced that I should navigate to the corresponding source file. Then I only needed to navigate to the folder and it was working.
How can this be done with Android Studio - I have the newest version 3.2.1 installed.
I finally found the solution.
I got a stripped version from my colleague, he basically gave me the version inside his apk which is stripped. Now he gave me directly the build version (I think it is located somewhere in the intermediate directory or so, just search for the name of the lib).
Under Run\Edit Configurations\Debugger\LLDB startup commands the original source directory can be mapped to the source directory on my computer which is different. To achieve this, enter "settings set target.source-map or-dir cur-dir"
There should be a way to find out the original source directory from the so file, but I don't know it right now.
I hope this can help somebody else

Android ADT 21 NoClassDefFoundError

I am using Salesforce SOAP API to do a simple login and logout program. I follow the sample code at http://www.salesforce.com/us/developer/docs/api/Content/sforce_api_calls_login.htm.
This code works fine on desktop.
Then, I port it to Android application with the generated jar file (it is sforce-client.jar) based on my WSDL file and the wsc.jar.
However, when I run it, I got the following error,
Could not find class 'com.sforce.soap.enterprise.EnterpriseConnection'
referenced from method salesforceAccess.SalesforceAccess.login
Do you have any idea what cause it and how to solve it?
Thank you so much for the help.
Ada
Did you add the jar file to the 'libs' directory and check the "Order and Export" checkbox under the properties?
If you followed the default instructions for building your jar from the WSDL, then you need to add both this generated jar, and the wsc.jar that you used to generate the jar to your android libs folder. From the error it sounds like you're missing the wsc.jar that you used to generate your jar from.
Alternatively you can set -Dstandalone-jar=true as an option when you generate your jar, and then everything will be in that one generated jar.
Finally, I solved the problem!
The steps are,
1. Build the correct wsc-xxx.jar file from github.com/forcedotcom/wsc (Thank you, Superfell!)
2. Generate the jar file from wsdl using the above wsc-xxx.jar. NOTE: using jdk1.6 to generate the target 1.6 jar. (or whatever match the Android SDK level!!)
3. Import the jars into the Android project.
I was stuck because I was using jdk1.7 to generate the jar file. However, like what this thread (Android emulator crash: "Dx bad class file magic" / ClassNotFoundException on startup?) said, the Android SDK level is 1.6 (I tried to change to 1.7, the project won't be able to compiled). Therefore, the generated jar file from wsdl won't be able to be packaged in!
The eclipse and ADT doesn't give me any warning or error to tell me. I have to build the Android project from command line (see http://randomsamples.info/blog/phil/android-adt-2101-javalangnoclassdeffounderror-rdimen) and noticed the warning,
[dx] trouble processing:
[dx] bad class file magic (cafebabe) or version (0033.0000)
[dx] ...while parsing com/sforce/soap/enterprise/EnterpriseConnection.cla
ss
[dx] ...while processing com/sforce/soap/enterprise/EnterpriseConnection. class
What a process!!

How to make an executable out of my LIBGDX game

I've never made a program into an executable before, and I've been looking into how to do this for some time now. When I try to put it into a jar everything works fine but when I try to run it nothing happens.
How do I make my game into an executable so it can be run (on windows, not android)
I feel like I am not Linking it to the libraries or something... Not sure.
Thanks!
Edit:
I should add I get the error
JAR export finished with warnings. See details for additional information.
duplicate entry: com/badlogic/gdx/utils/arial-15.fnt
duplicate entry: com/badlogic/gdx/utils/arial-15.fnt
duplicate entry: com/badlogic/gdx/utils/arial-15.png
duplicate entry: com/badlogic/gdx/utils/arial-15.png
Jar export finished with problems.
See details for additional information.
Your problem is that when you use eclipse export as Executable jar file it does not include the assets (graphical, sounds ...) that you used in your gdx project. What you can do manually is either copy your assets folder right next to the generated jar file or include your assets folder in your jar file with your favorite zip management tool.
Another way would be to use this same eclipse export wizard and check "Save as ANT script" and then edit the generated ant file to include all the files and folders needed by your app.
Hope this helps
This is an old question, but if you are using a new version of LibGDX and Gradle you can use the command line to make an executable.
There are several commands, but these are for packaging:
Desktop
gradlew desktop:dist
Android (unsigned)
gradlew android:assembleRelease
iOS
gradlew ios:createIPA
Web
gradlew html:dist
Read more at https://github.com/libgdx/libgdx/wiki/Gradle-on-the-Commandline
I'm assuming your application is setup as the libgdx wiki page suggests (with a "main project" and separate "desktop" and "android" projects that share the sources from the "main" project).
Since your app is written in Java, it requires a JVM to run on a desktop. You have to decide if you want to package that up, or rely on a JVM already being installed by the user. I believe packaging up the JVM with Java class files is very complicated and raises a host of other issues (and it becomes very platform specific). So, I believe most libgdx-based games get distributed as an executable Jar file, which means the user must already have Java. (It works for Minecraft, so its probably good enough for you, too. :)
Eclipse makes that really easy: File -> Export ... -> Java -> Executable Jar File. There may be additional steps required to include assets like your app's images and sounds into this .jar file. (My game is currently "asset free", so I don't have any experience with this part.)
You might also consider side-stepping the desktop executable, and packaging your game as an applet and running it in a web browser so there is very little "installation" required by the folks you want to show it to. Here's a walkthrough for making an applet from a libgdx-based game. (I haven't actually tried this myself yet, but I do have a libgdx-based game that I'm planning on doing this for.)
If you're using Android Studio, you can create a custom configuration to distribute from within the program.
On the Run dropdown list select edit configurations.
Click the "+". Select Gradle.
On the right half of that screen give your configuration a Name.
Gradle Project: Use the browse button to select your desktop application. This will look something like (project name):desktop
Tasks: type "desktop:dist"
Apply.
Close the configuration editor and select your new configuration from the dropdown. Hit run and it should build your project.
Your new Jar file should be located in (ProjectName)/desktop/build/libs

I got the error on sample project "Hello Word" on android - cocos2d

I have eclipse 3.7, cocos2d-1.0.1-x-0.9.2, android-ndk-r7.
When I have create sample project but, it will get error "FORCE CLOSE"...
So is there any other thing i want to include on the project ?
Your main application has a load static library method that is pointing to a nonexistent library, which means it has not found it. Recheck your makefiles for the correct module name. Also make sure they have compiled correctly with NDK beforehand and the .a and .so files are in the lib folder.

How to include JAR in APK without Eclipse?

I maintain an Android app and am not using Eclipse. I am not using Eclipse. I am using ant and build.xml and build.properties.
I have places my .jar file into the libs/ directory. My code compiles just dandy. But when I run it on the emulator, the output APK does not include the .jar, so I get a runtime stacktrace:
ERROR/AndroidRuntime(470): java.lang.NoClassDefFoundError: com.google.ads.AdView
my build.properties looks like this:
jar.libs.dir=libs
And the libs/ directory contains my .jar file.
What needs to be in build.xml so that the external .jar file is included in the APK?
Edit: In theory this answer should work, but it doesn't for me. Is it out of date? What gives? How to add external jar libraries to an android project from the command line
I just came over a similar problem and noticed that libraries should not be placed in "myprojectdir\lib". When I moved them to "myprojectdir\libs" everything started to work.
It turns out that I needed to upgrade the version of ant I was using to 1.8. During the compile process, I had been getting this error message:
Warning: Reference out.dex.jar.input.ref has not been set at runtime,
but was found duringbuild file parsing, attempting to resolve. Future
versions of Ant may support referencing ids defined in non-executed
targets.
I googled it, and found that I needed to upgrade Ant, and now I don't get this warning, and my application does not force close.
What needs to be in build.xml so that the external .jar file is included in the APK?
Just putting it in libs/ is sufficient.
my build.properties looks like this:
That line should not be necessary. It does not appear in my build.properties files that build successfully with JAR files.
If you use dexdump -f classes.dex from your project's bin/ directory, you will be able to determine whether com.google.ads.AdView made it in there. If it did not, then something is strange with your build scripts. If it did, then perhaps there is a dependent JAR that you are missing (though I would expect a VerifyError in that case).
You use 3rd party library, but you seem didn't run DX on it. Make sure that not only your code processed by DX tool (I assume Ant does it), but also all 3rd party libraries you use. You can look in 7Bee script I use to convert web applications to Android davlik format, so it can work for you too. You can find more about the script on Atjeews page.
Solution:
right click on the project in project tree and select Project
properties
select Java Build Path
select TAB Order
and Export
check GoogleAdMobAdsSdk-4.0.4.jar (or your
version SDK)
press OK
clean project by menu Project
-> Clean
rebuild project (Project – Build Automatically)

Categories

Resources