Adobe air native extension with android external jars (aapt tool failed:ERROR) - java

I have a native android extension that referencing an android library project.
Inside referenced android library project I have several "JARs" in the "lib" folder.
I use eclipse to export a final "JAR" that referenced by the "extesion.xml" file.
All other jars that used to be included in the "libs" folder are referenced by dependancies xml file. that looks like this :
<platform xmlns="http://ns.adobe.com/air/extension/14.0">
<packagedDependencies>
<packagedDependency>async-http-client-1.8.6.jar</packagedDependency>
<packagedDependency>netty-3.9.0.Final.jar</packagedDependency>
<packagedDependency>slf4j-api-1.7.7.jar</packagedDependency>
<packagedDependency>slf4j-nop-1.7.7.jar</packagedDependency>
<packagedDependency>wasync-1.3.2.jar</packagedDependency>
</packagedDependencies>
<packagedResources>
</packagedResources>
Here how I export the final JAR using eclipse :
Now here is the command line that I use to build my ANE file :
adt -package -target ane GDAndroidNativeExtention.ane extension.xml -swc GDAndroidNativeExtention.swc -platform Android-ARM -platformoptions platform-options-android.xml -C android . -platform default -C default .
That builds me a nice ANE file which I then copy pasting into my IntelliJ IDEA 13.1.4 .
However when I am trying to compile to android the following error appears :
aapt tool failed:ERROR: 'C:\Program Files (x86)\Adobe Gaming SDK 1.3\AIR SDK\lib\android\lib\resources\android-res.jar' is not a directory
Well I would really like to know what it means and how it can be fixed.
I do know that the same extension works when I am compiling it without "platformoptions" command .But when I do that application runs but does not executes the code that referenced in jars. I can clearly see in the logcat messages like :
Could not find class 'com.ning.http.client.AsyncHttpClientConfig$Builder', referenced from method com.gd.server.connector.internal.http.TRXAtmosphereConnection.createConfigurableSocket
And I did already try to include those jars while exporting my extension from eclipse.It didn't see references to those jars even in that case.
Bottom line all I need is my extension to work.And I will be happy to know of any alternatives.
Thanks in advance.

Related

Where does eclipse keep the information about the sources

Yesterday I've imported some Java files within my Java project (just for being able to compile them into *.class files), I have then removed those files and now my Eclipse is constantly showing the following complaints:
Could not move: <the mentioned Java file>
File not found: <again the mentioned Java file>
In top of that Eclipse mentions this issue being present in the plugin "org.eclipse.core.filesystem".
Now I'd like to do the following:
I'd like to go to the file which contains this obsolete reference and delete it in that file. (In Visual Studio this is a piece of cake)
How can I do this in Eclipse? Where does Eclipse store its project file(s)?
Put the mouse cursor on the class or method name in source code and hit
Ctrl+Shift+G.

Netbeans automatically cloning my jar based packages with their empty 'name equivalents'

I'm new at java programming so i just wanted to try something with ssh understand how it works and so i downloaded a java library which is mentioned in this Stack Overflow answer
. After a lot of failed attempts on importing this library into netbeans. I decided to simply put the files into my src folder. But Netbeans ide duplicating packages in the jar file with their 'name equivalent' empty packages and this prevents me to reach the classes in the packages because the IDE and the Code completion automatically sees the empty packs.I've search the network couldn't find anything about this problem.I 'm ready to share any log files if there are any of them .Here is my screenshot about this situation.
Screenshot Attachment
OS : Linux Mint Rosa
IDE : Netbeans 8.1 Linux version
Edit : I Already looked these topics
How to use .jar files in NetBeans? : At first i've tried this and in this solution netbeans not duplicating any empty packs but when i start to type somethin' like that import sshj.foo.*; Auto Complete can't find anything and also if i try to write the whole path to a specific class which is in an specific pack IDE gave me an error the pack that you're looking for is not exist.Secondly I've tried this
and got the same issue at first try.I can see the packs,classes and other stuff but still can't reach them in a random class which is imported project.
How can I include external jar on my Netbeans project : I've tried this and also this ran perfectly without errors as they said but when i try to reach classes still got the same problem so nothing changed.
How to add a JAR in NetBeans :
In this topic all of the replies explained types of libraries.That's not even related to my problem
How to use classes from .jar files? : I've tried to do explained in this reply also and I've transfered my jar file into a compiled .class extension file and this didn't solve my issue too.
I've just solved that problem with downloading part of the libraries from here.
All libraries need to contain three kind of jars ;
1 . Compiled files containing jar (with extension .class)
2 . Source files containing jar (with extension .java)
3 . Javadoc files containing jar (optional)
Open a project find libraries folder on ide right click and choose Add JAR/Folder specify the directory that contains the compiled files.After importing library hit right click over it and choose edit then specify the source files and javadoc files directories you are ready to roll.

how to include sqlite4java in android project

I am trying to use sqlite4java in my android project. the following screenshot shows my project's setup:
As you can see i have copied the jar-file into my libs folder and included it in the build path. I have also copied the docs and the src-file as per the docs for sqlite4java. The zip-file i downloaded also contains a library-file called libsqlite4java-android-i686.sothat i included in the libs directory. what i get when i try to run my project (it will compile without complaining) is the follwing error message:
03-04 07:37:13.251: W/System.err(2419):
com.almworks.sqlite4java.SQLiteException: [-91] cannot load library:
java.lang.UnsatisfiedLinkError: Couldn't load sqlite4java-android-i686
from loader dalvik.system.PathClassLoader[DexPathList[[zip file "/data
/app/de.redhouse24.android-2.apk"],nativeLibraryDirectories=[/data
/app-lib/de.redhouse24.android-2, /system/lib]]]: findLibrary returned
null
As you can see the file sqlite4java-android-i686.socannot be found. Being wiley, i renamed the libsqlite4java-andriod-i686.so file to sqlite4java-android-i686.so, which is why my project structure shows that name for the file. TBH, i renamed it because i found the suggestion in this discussion:
https://code.google.com/p/sqlite4java/issues/detail?id=42
I also tried to include the so-file in the build path, but that just stopped my project from compiling.
My question: What do i need to do to use sqlite4java in my android project?
Im using a mac and eclipse with adt, if that makes any difference.
First of all, renaming the library will not help you. Do not rename the library, leave the name as it was.
Second, you only have the 686-lib there.
If you intent to run your app on something other than an atom-based device, you will have to add the so-files for the other architectures as well.
Each architecture's so-files resides in a sub-directory under the libs directory, like this:
libs/x86
libs/armeabi
libs/armeabi-v7a
Put your libsqlite4java-android-i686.so file there, and also possible other .so files it might need as a dependency, and it should work.
Including the sources and docs into the libs-folder somewhat eludes me. That will only bloat your final apk file, which should be avoided.
Your users will be thankful.

Javah: Error: cannot access android.support.v7.app.ActionBarActivity

I have a problem with javah, I have read about 4 or 5 stakcoverflow posts with the error "solved" but anything works for me.
My problem:
When i execute the javah command i have this error:
Error: cannot access android.support.v7.app.ActionBarActivity
class file for android.support.v7.app.ActionBarActivity not found
What I have tried:
This is the command that I have tested:
C:\Users\MyUser\workspace3\PruebaApp\jni\include>javah -classpath ../../bin/classes;C:\Users\MyUser\AppData\Local\Android\sdk\platforms\android-14\android.jar -o ACK.h com.test.prueba.ACK
I have tried too the same command with only "/" and only "\" for separating direcotries.
I have tried it with android-11, android-14, and android-21.
I have tried to add the following external jars to my project:
"android-support-v4.jar" and "android-support-v7-appcompat.jar"
I have tried to do it creating a external build configuration with eclipse, like here: Javah Error android.app.Activity not found
Tools I'm using
I'm working with eclipse juno, on windows 8.1.
The folder from which I executed the command is {project_dir}/jni/include. I have tried it from different folders, modifying the command correctly.
The .java file that contains the native function is "ACK.java" in the package: "com.test.prueba"
In the project, the android library that I'm using is android 5.0.1
What can I do? Thanks in advance.
The native methods declared in your java class is enough for generating JNI header. In your example, the command javah's option -classpath is not very useful. Suppose com/test/prueba/ACK.java is the class you process to generate JNI header. You can change the working directory to {project_dir}\src, execute the command
javah com.test.prueba.ACK
the corresponding JNI header file com_test_prueba_ACK.h will be created in the current directory.
You should write full path of android-support-v7-appcompat.jar and android-support-v4.jar in classpath parameter.
Please have a look to my answer https://stackoverflow.com/a/52527212/2573138
which integrates in Android Studio the way described by alijandro.

Exported Runnable Jar File - I know what's wrong but not how to fix

How to export to runnable java file with eclipse using slick and lwjgl (Light Weight Java Graphics Library)?
So, I have done some research into this and believe I have found the root of the problem and what needs fixing, now I need to figure out how to fix it.
I have a fairly large project that use slick and lwjgl. These are both provided as .jar files that I have added to the java build path in my IDE (Eclipse INDIGO, in case you where wondering).
My goal is to export the piece into a single runnable jar file. Eclipse gives me three options for this:
Extract required libraries into generated JAR
Package required libraries into generated JAR
Copy required into a sub-folder next to the generated JAR
I have been gunning for the second options and it seems the easiest to deal with logically. Anyway when I select this option I press the FINISH option (the only one available to me other than BACK and CANCEL) I get the generation progress popping up for a sec and all seem well. However, if I run the resulting file I get an Unresolved Linker Error as it cannot find lwjgl.
Seeing as both slick.jar and lwgjl.jar are inside the generated JAR when viewed with winRar, I assume that some information is being lost about the java build path when everything goes from the IDE to the runnable JAR.
My research so far seems to suggest I can point the generated JAR to the enclosed files it needs through something in the manifest.txt file but this is were I have been unable to find anything more concrete.
Can anyone please advise me where to go from here?
P.S: I have tried almost every permutation of the export option and environmental options for the build path but when I run the generated JAR it get various differing errors that still all mean "I cannot find this here external".
P.P.S: I forgot to add, eclipse itself is mentioned in the manifest file as follows:
Manifest-Version: 1.0
Rsrc-Class-Path: ./ lwjgl.jar slick.jar
Class-Path: . lwjgl.jar slick.jar
Rsrc-Main-Class: Game.Game
Main-Class: org.eclipse.jdt.internal.jarinjarloader.JarRsrcLoader
Every bit of common sense tells me that needs to be changed as it refers to the .jars' location but again, not sure what to or where to begin.
You could use JarSplice, just export the jar from Eclipse, with your classes and resources (don't include any libraries at this point), then use JarSplice to add any libraries and natives (like lwjgl and slick) and make the jar runnable.

Categories