Hi
At the open source hangout on Saturday I demonstrated the new Sphero component written for AI and mentioned I am having difficultly adding one of library files required to the make the Sphero component working. I have a work around but it is not ideal would really appreciate any help to solve the issue and I am having.
The 2 file library files required for Sphero are:
I have been able to include RobotLibrary.jar without any issues but haven't been able to add libachievement_manager.so file successful in the AI source code. The file libachievement_manager.so is used to check Sphero status when connection is established. Without this library file the app connects to sphero but then crashes. The missing file has to be located in the folder lib\armeabi\ at build time.
Currently I have a work around to add the missing libachievement_manager.so file outside of the AI Source code by doing the following steps using apktool
I use the same technique when building project Apk’s for sphero.
Due to no other component in AI using extra library files that are required to be place in lib\armeabi I have nothing to reference to. In the AI Source code I have found roughly where this file should be added (as shown below) but am unsure are how to add the file the correctly
appinventor-sources / appinventor / buildserver / src / com / google / appinventor / buildserver / Compiler.java
private boolean insertNativeLibraries(File buildDir){
libsDir = createDirectory(buildDir, LIBS_DIR_NAME);
File apkLibDir = createDirectory(libsDir, APK_LIB_DIR_NAME); // This dir will be copied to apk.
File armeabiDir = createDirectory(apkLibDir, ARMEABI_DIR_NAME);
File armeabiV7aDir = createDirectory(apkLibDir, ARMEABI_V7A_DIR_NAME);
/*
* Native libraries are targeted for particular processor architectures.
* Here, non-default architectures (ARMv5TE is default) are identified with suffixes
* before being placed in the appropriate directory with their suffix removed.
*/
try {
for (String library : nativeLibrariesNeeded) {
if (library.endsWith(ARMEABI_V7A_SUFFIX)) { // Remove suffix and copy.
library = library.substring(0, library.length() - ARMEABI_V7A_SUFFIX.length());
Files.copy(new File(getResource(RUNTIME_FILES_DIR + ARMEABI_V7A_DIRECTORY +
File.separator + library)), new File(armeabiV7aDir, library));
} else {
Files.copy(new File(getResource(RUNTIME_FILES_DIR + library)),
new File(armeabiDir, library));
}
}
return true;
} catch (IOException e) {
e.printStackTrace();
userErrors.print(String.format(ERROR_IN_STAGE, "Native Code"));
return false;
}
}
Line 1065
|
Also I think the lib\armeabi\libachievement_manager.so file would need to be added to the following biulld files as I have already done this for the lib\RobotLibrary.jar file
Decompiling and recompiling apk files outside of AI isn’t really
the route I want to take as it is messy even though it works. I would really appreciate any help adding the
missing lib\armeabi\libachievement_manager.so correctly via the AI Source
code. If you need any more information let know.
Thank you in advance of any help.
Gareth
@UsesNativeLibraries(libraries="libachievement_manager.so")public class MyComponent extends ...
--
You received this message because you are subscribed to the Google Groups "App Inventor Open Source Development" group.
To unsubscribe from this group and stop receiving emails from it, send an email to app-inventor-open-so...@googlegroups.com.
To post to this group, send email to app-inventor-o...@googlegroups.com.
Visit this group at http://groups.google.com/group/app-inventor-open-source-dev.
For more options, visit https://groups.google.com/d/optout.
[java] INFO: The current progress is 10%
[java] Android Manifest: including <receiver> tag
[java] Sep 30, 2014 7:34:59 PM com.google.appinventor.buildserver.Compiler
generatePermissions
[java] INFO: usesLocation = False
[java] Sep 30, 2014 7:34:59 PM com.google.appinventor.buildserver.Compiler
setProgress
[java] INFO: The current progress is 15%
[java] Sep 30, 2014 7:34:59 PM com.google.appinventor.buildserver.Compiler
writeAndroidManifest
[java] INFO: VCode: 222
[java] Sep 30, 2014 7:34:59 PM com.google.appinventor.buildserver.Compiler
writeAndroidManifest
[java] INFO: VName: 2.22ai2
[java] Sep 30, 2014 7:34:59 PM com.google.appinventor.buildserver.Compiler
setProgress
[java] INFO: The current progress is 20%
[java] java.lang.NullPointerException
[java] at com.google.common.base.Preconditions.checkNotNull(Preconditio
ns.java:191)
[java] at com.google.common.io.Resources$UrlByteSource.<init>(Resources
.java:77)
[java] at com.google.common.io.Resources$UrlByteSource.<init>(Resources
.java:72)
[java] at com.google.common.io.Resources.asByteSource(Resources.java:66
)
[java] at com.google.common.io.Resources.newInputStreamSupplier(Resourc
es.java:57)
[java] at com.google.appinventor.buildserver.Compiler.getResource(Compi
ler.java:1142)
[java] at com.google.appinventor.buildserver.Compiler.insertNativeLibra
ries(Compiler.java:1080)
[java] at com.google.appinventor.buildserver.Compiler.compile(Compiler.
java:548)
[java] at com.google.appinventor.buildserver.ProjectBuilder.build(Proje
ctBuilder.java:163)
[java] at com.google.appinventor.buildserver.Main.main(Main.java:81)
BUILD FAILED
C:\AI\appinventor-sources\appinventor\build.xml:46: The following error occurred
while executing this line:
C:\AI\appinventor-sources\appinventor\buildserver\build.xml:161: Java returned:
1
Total time: 26 seconds
To unsubscribe from this group and stop receiving emails from it, send an email to app-inventor-open-source-dev+unsub...@googlegroups.com.
To post to this group, send email to app-inventor-o...@googlegroups.com.
Visit this group at http://groups.google.com/group/app-inventor-open-source-dev.
For more options, visit https://groups.google.com/d/optout.
--
You received this message because you are subscribed to the Google Groups "App Inventor Open Source Development" group.
To unsubscribe from this group and stop receiving emails from it, send an email to app-inventor-open-source-dev+unsub...@googlegroups.com.
To post to this group, send email to app-inventor-o...@googlegroups.com.
Visit this group at http://groups.google.com/group/app-inventor-open-source-dev.
For more options, visit https://groups.google.com/d/optout.
I'll poke at it when I get a chance. The UsesNativeLibraries annotation is new and not currently used elsewhere so it may well be broken.
-Jeff
P. S. You are welcome to debug it as well.
--
You received this message because you are subscribed to the Google Groups "App Inventor Open Source Development" group.
To unsubscribe from this group and stop receiving emails from it, send an email to app-inventor-open-so...@googlegroups.com.
I've sent a message to Trevor to see if he would be willing to help.-Mark
On Wed, Oct 1, 2014 at 6:59 AM, Gareth Haylings <gareth....@googlemail.com> wrote:
I will see if a can figure out if it is something I'm doing of if @UsesNativeLibraries is broken , but if you do have a chance to look at this that work be great Jeff.I noticed another annotation which I don't think is used anywhere else @UsesAssets (I might be wrong)In the example Mark supplied only the Instrument.java is available so it's hard to work out if I have missed or incorrectly defined something in another file for the @UsesNativeLibraries to work. One thing that would really help to understand this properly and check I'm defining everything correctly would be to have access to the whole of Trevor B. Adams the code. Is this possible?Thanks for the help so Mark & Jeff
On Wednesday, 1 October 2014 14:10:39 UTC+1, j...@mit.edu wrote:I'll poke at it when I get a chance. The UsesNativeLibraries annotation is new and not currently used elsewhere so it may well be broken.
-Jeff
P. S. You are welcome to debug it as well.
--
You received this message because you are subscribed to the Google Groups "App Inventor Open Source Development" group.
To unsubscribe from this group and stop receiving emails from it, send an email to app-inventor-open-source-dev+unsub...@googlegroups.com.
Thanks for looking at this JeffI have updated my GitStill fails to build but I have added both native Libraries. Looking at the code I think the name I have given the libachievement_manager.so-v7a for the \libs\armeabi-v7a is right. Here are the 2 native library fileslibachievement_manager.so is for \libs\armeabilibachievement_manager.so-v7a is for \libs\armeabi-v7aWill carry on looking at this tonight when I get home from work.
String[] aaptPackageCommandLine = {
getResource(aaptTool),
"package",
"-v",
"-f",
"-M", manifestFile.getAbsolutePath(),
"-S", resDir.getAbsolutePath(),
"-A", project.getAssetsDirectory().getAbsolutePath(),
"-I", getResource(ANDROID_RUNTIME),
"-F", tmpPackageName,
};
Not sure if the missing native library can be added to the above code but if not I think it can be done with something like the following but will have to work this out:
aapt.exe a "MIT AI2 Companion.apk" lib/armeabi /libachievement_manager.so
aapt.exe a "MIT AI2 Companion.apk" lib/armeabi-v7a /libachievement_manager.so
Any thoughts on this?
String[] aaptPackageCommandLine = {
getResource(aaptTool),
"package",
"-v",
"-f",
"-M", manifestFile.getAbsolutePath(),
"-S", resDir.getAbsolutePath(),
"-A", project.getAssetsDirectory().getAbsolutePath(),
"-I", getResource(ANDROID_RUNTIME),
"-F", tmpPackageName,
libsDir.getAbsolutePath()
};
HiMy pull request to fix this is now done https://github.com/themadrobot/appinventor-sources/commit/7a06108efba928aff5e35dc9fef7031375705de4?diff=unified
--
You received this message because you are subscribed to the Google Groups "App Inventor Open Source Development" group.
To unsubscribe from this group and stop receiving emails from it, send an email to app-inventor-open-so...@googlegroups.com.
Hello!
I have read your comments carefully.But I do not know the rules to create the ***.so file and the way to use the function in it .I have written a **.so file with NDK support.The extension component file can be built successfully.But When I use it to built the app.It dose not work.Can you give me some tips on how to create the ***.so file and the way to use the fuction in it?
Thank you in advance!
The attachment is extension source code .The figures below are the .so file source code and the result
To unsubscribe from this group and stop receiving emails from it, send an email to app-inventor-open-source-dev+unsub...@googlegroups.com.
To post to this group, send email to app-inventor-o...@googlegroups.com.
Visit this group at http://groups.google.com/group/app-inventor-open-source-dev.
For more options, visit https://groups.google.com/d/optout.
To unsubscribe from this group and stop receiving emails from it, send an email to app-inventor-open-source-dev+unsub...@googlegroups.com.
To post to this group, send email to app-inventor-o...@googlegroups.com.
Visit this group at http://groups.google.com/group/app-inventor-open-source-dev.
For more options, visit https://groups.google.com/d/optout.
To unsubscribe from this group and stop receiving emails from it, send an email to app-inventor-open-source-dev+unsub...@googlegroups.com.
To post to this group, send email to app-inventor-o...@googlegroups.com.
Visit this group at http://groups.google.com/group/app-inventor-open-source-dev.
For more options, visit https://groups.google.com/d/optout.
To unsubscribe from this group and stop receiving emails from it, send an email to app-inventor-open-source-dev+unsub...@googlegroups.com.
To post to this group, send email to app-inventor-o...@googlegroups.com.
Visit this group at http://groups.google.com/group/app-inventor-open-source-dev.
For more options, visit https://groups.google.com/d/optout.
To unsubscribe from this group and stop receiving emails from it, send an email to app-inventor-open-source-dev+unsub...@googlegroups.com.
To post to this group, send email to app-inventor-o...@googlegroups.com.
Visit this group at http://groups.google.com/group/app-inventor-open-source-dev.
For more options, visit https://groups.google.com/d/optout.
To unsubscribe from this group and stop receiving emails from it, send an email to app-inventor-open-source-dev+unsub...@googlegroups.com.
To post to this group, send email to app-inventor-o...@googlegroups.com.
Visit this group at http://groups.google.com/group/app-inventor-open-source-dev.
For more options, visit https://groups.google.com/d/optout.
To unsubscribe from this group and stop receiving emails from it, send an email to app-inventor-open-source-dev+unsub...@googlegroups.com.
To post to this group, send email to app-inventor-o...@googlegroups.com.
Visit this group at http://groups.google.com/group/app-inventor-open-source-dev.
For more options, visit https://groups.google.com/d/optout.
To unsubscribe from this group and stop receiving emails from it, send an email to app-inventor-open-source-dev+unsub...@googlegroups.com.
To post to this group, send email to app-inventor-o...@googlegroups.com.
Visit this group at http://groups.google.com/group/app-inventor-open-source-dev.
For more options, visit https://groups.google.com/d/optout.
To unsubscribe from this group and stop receiving emails from it, send an email to app-inventor-open-source-dev+unsub...@googlegroups.com.
To post to this group, send email to app-inventor-o...@googlegroups.com.
Visit this group at http://groups.google.com/group/app-inventor-open-source-dev.
For more options, visit https://groups.google.com/d/optout.
To unsubscribe from this group and stop receiving emails from it, send an email to app-inventor-open-source-dev+unsub...@googlegroups.com.
To unsubscribe from this group and stop receiving emails from it, send an email to app-inventor-open-source-dev+unsub...@googlegroups.com.
To post to this group, send email to app-inventor-o...@googlegroups.com.
Visit this group at http://groups.google.com/group/app-inventor-open-source-dev.
For more options, visit https://groups.google.com/d/optout.
--
You received this message because you are subscribed to the Google Groups "App Inventor Open Source Development" group.
To unsubscribe from this group and stop receiving emails from it, send an email to app-inventor-open-source-dev+unsub...@googlegroups.com.
To post to this group, send email to app-inventor-o...@googlegroups.com.
Visit this group at http://groups.google.com/group/app-inventor-open-source-dev.
For more options, visit https://groups.google.com/d/optout.