How to use Annotation @UsesAssets?

Dear all,

How to use annotation @UsesAssets?

I have asset with 2 folder,every folder have 1 file,

assets/armeabi-v7a/ffmpeg

and

assets/x86/ffmpeg

i have try use this:

@UsesAssets(fileNames = "armeabi-v7a/ffmpeg, x86/ffmpeg")

but get error

java.io.FileNotFoundException: D:\appinventor-extensions\appinventorbaru\appinventor-sources\appinventor\components\build\externalComponents....\src\com\kangris\Ffmpeg\assets\x86
fmpeg (The filename, directory name, or volume label syntax is incorrect)

Thanks.

Regard.
kangris

1 Like

That looks like the right usage to me, but it’s not clear that this is the full error text. Can you please paste the whole error output?

2 Likes

Build is Succesful sir @ewpatton

but i see error like this:

 [java] Extensions : Generating files [com.kangris.Ffmpeg]
 [java] Extensions : Skipping missing icon images/extension.png
 [java] java.io.FileNotFoundException: D:\appinventor-extensions\appinventorbaru\appinventor-sources\appinventor\components\build\externalComponents\com.kangris.Ffmpeg\assets\x86\ffmpeg (The system cannot find the path specified)
 [java]     at java.io.FileOutputStream.open0(Native Method)
 [java]     at java.io.FileOutputStream.open(FileOutputStream.java:270)
 [java]     at java.io.FileOutputStream.<init>(FileOutputStream.java:213)
 [java]     at java.io.FileOutputStream.<init>(FileOutputStream.java:101)
 [java]     at com.google.appinventor.components.scripts.ExternalComponentGenerator.copyFile(ExternalComponentGenerator.java:308)
 [java]     at com.google.appinventor.components.scripts.ExternalComponentGenerator.copyAssets(ExternalComponentGenerator.java:261)
 [java]     at com.google.appinventor.components.scripts.ExternalComponentGenerator.generateAllExtensions(ExternalComponentGenerator.java:111)
 [java]     at com.google.appinventor.components.scripts.ExternalComponentGenerator.main(ExternalComponentGenerator.java:71)
 [java]     at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
 [java]     at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
 [java]     at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
 [java]     at java.lang.reflect.Method.invoke(Method.java:498)
 [java]     at org.apache.tools.ant.taskdefs.ExecuteJava.run(ExecuteJava.java:221)
 [java]     at org.apache.tools.ant.taskdefs.ExecuteJava.execute(ExecuteJava.java:154)
 [java]     at org.apache.tools.ant.taskdefs.Java.run(Java.java:832)
 [java]     at org.apache.tools.ant.taskdefs.Java.executeJava(Java.java:226)
 [java]     at org.apache.tools.ant.taskdefs.Java.executeJava(Java.java:135)
 [java]     at org.apache.tools.ant.taskdefs.Java.execute(Java.java:108)
 [java]     at org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:293)
 [java]     at sun.reflect.GeneratedMethodAccessor4.invoke(Unknown Source)
 [java]     at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
 [java]     at java.lang.reflect.Method.invoke(Method.java:498)
 [java]     at org.apache.tools.ant.dispatch.DispatchUtils.execute(DispatchUtils.java:106)
 [java]     at org.apache.tools.ant.Task.perform(Task.java:352)
 [java]     at org.apache.tools.ant.Target.execute(Target.java:437)
 [java]     at org.apache.tools.ant.Target.performTasks(Target.java:458)
 [java]     at org.apache.tools.ant.Project.executeSortedTargets(Project.java:1406)
 [java]     at org.apache.tools.ant.helper.SingleCheckExecutor.executeTargets(SingleCheckExecutor.java:36)
 [java]     at org.apache.tools.ant.Project.executeTargets(Project.java:1261)
 [java]     at org.apache.tools.ant.taskdefs.Ant.execute(Ant.java:442)
 [java]     at org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:293)
 [java]     at sun.reflect.GeneratedMethodAccessor4.invoke(Unknown Source)
 [java]     at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
 [java]     at java.lang.reflect.Method.invoke(Method.java:498)
 [java]     at org.apache.tools.ant.dispatch.DispatchUtils.execute(DispatchUtils.java:106)
 [java]     at org.apache.tools.ant.Task.perform(Task.java:352)
 [java]     at org.apache.tools.ant.Target.execute(Target.java:437)
 [java]     at org.apache.tools.ant.Target.performTasks(Target.java:458)
 [java]     at org.apache.tools.ant.Project.executeSortedTargets(Project.java:1406)
 [java]     at org.apache.tools.ant.Project.executeTarget(Project.java:1377)
 [java]     at org.apache.tools.ant.helper.DefaultExecutor.executeTargets(DefaultExecutor.java:41)
 [java]     at org.apache.tools.ant.Project.executeTargets(Project.java:1261)
 [java]     at org.apache.tools.ant.Main.runBuild(Main.java:857)
 [java]     at org.apache.tools.ant.Main.startAnt(Main.java:236)
 [java]     at org.apache.tools.ant.launch.Launcher.run(Launcher.java:287)
 [java]     at org.apache.tools.ant.launch.Launcher.main(Launcher.java:112)
 [java] java.lang.IllegalStateException: Unable to copy asset to destination.
 [java]     at org.apache.tools.ant.taskdefs.ExecuteJava.execute(ExecuteJava.java:198)
 [java]     at org.apache.tools.ant.taskdefs.Java.run(Java.java:832)
 [java]     at org.apache.tools.ant.taskdefs.Java.executeJava(Java.java:226)
 [java]     at org.apache.tools.ant.taskdefs.Java.executeJava(Java.java:135)
 [java]     at org.apache.tools.ant.taskdefs.Java.execute(Java.java:108)
 [java]     at org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:293)
 [java]     at sun.reflect.GeneratedMethodAccessor4.invoke(Unknown Source)
 [java]     at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
 [java]     at java.lang.reflect.Method.invoke(Method.java:498)
 [java]     at org.apache.tools.ant.dispatch.DispatchUtils.execute(DispatchUtils.java:106)
 [java]     at org.apache.tools.ant.Task.perform(Task.java:352)
 [java]     at org.apache.tools.ant.Target.execute(Target.java:437)
 [java]     at org.apache.tools.ant.Target.performTasks(Target.java:458)
 [java]     at org.apache.tools.ant.Project.executeSortedTargets(Project.java:1406)
 [java]     at org.apache.tools.ant.helper.SingleCheckExecutor.executeTargets(SingleCheckExecutor.java:36)
 [java]     at org.apache.tools.ant.Project.executeTargets(Project.java:1261)
 [java]     at org.apache.tools.ant.taskdefs.Ant.execute(Ant.java:442)
 [java]     at org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:293)
 [java]     at sun.reflect.GeneratedMethodAccessor4.invoke(Unknown Source)
 [java]     at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
 [java]     at java.lang.reflect.Method.invoke(Method.java:498)
 [java]     at org.apache.tools.ant.dispatch.DispatchUtils.execute(DispatchUtils.java:106)
 [java]     at org.apache.tools.ant.Task.perform(Task.java:352)
 [java]     at org.apache.tools.ant.Target.execute(Target.java:437)
 [java]     at org.apache.tools.ant.Target.performTasks(Target.java:458)
 [java]     at org.apache.tools.ant.Project.executeSortedTargets(Project.java:1406)
 [java]     at org.apache.tools.ant.Project.executeTarget(Project.java:1377)
 [java]     at org.apache.tools.ant.helper.DefaultExecutor.executeTargets(DefaultExecutor.java:41)
 [java]     at org.apache.tools.ant.Project.executeTargets(Project.java:1261)
 [java]     at org.apache.tools.ant.Main.runBuild(Main.java:857)
 [java]     at org.apache.tools.ant.Main.startAnt(Main.java:236)
 [java]     at org.apache.tools.ant.launch.Launcher.run(Launcher.java:287)
 [java]     at org.apache.tools.ant.launch.Launcher.main(Launcher.java:112)
 [java] Caused by: java.lang.IllegalStateException: Unable to copy asset to destination.
 [java]     at com.google.appinventor.components.scripts.ExternalComponentGenerator.copyAssets(ExternalComponentGenerator.java:263)
 [java]     at com.google.appinventor.components.scripts.ExternalComponentGenerator.generateAllExtensions(ExternalComponentGenerator.java:111)
 [java]     at com.google.appinventor.components.scripts.ExternalComponentGenerator.main(ExternalComponentGenerator.java:71)
 [java]     at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
 [java]     at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
 [java]     at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
 [java]     at java.lang.reflect.Method.invoke(Method.java:498)
 [java]     at org.apache.tools.ant.taskdefs.ExecuteJava.run(ExecuteJava.java:221)
 [java]     at org.apache.tools.ant.taskdefs.ExecuteJava.execute(ExecuteJava.java:154)
 [java]     ... 32 more
 [java] Java Result: -1
1 Like

Are you sure that the file in question doesn’t have an extension and Windows is hiding it from you? If it’s a library, I would expect it to have a .so extension.

1 Like

Yes sir @ewpatton
This ffmpeg binary..

my other annotation :

@UsesLibraries(libraries = "ffmpeg.jar")
@UsesAssets(fileNames = "armeabi-v7a/ffmpeg, x86/ffmpeg")
@UsesNativeLibraries(libraries = "lib-armeabi.so, lib-armeabi-v7a.so, lib-x86.so")

I have try

@UsesAssets(fileNames = "ffmpeg")

And Build Succesful without error...

But After import extension on App Inventor get Notif :

Import Extension Failed!
nulll

Or maybe i cant use ffmpeg binary to make extension :thinking:

That seems really suspect to me, and I’m not sure that you can execute binaries directly from the app data space. Have you tried doing what you want to do with a normal app? I would imagine that rather than including the ffmpeg binary directly, you’d be using dynamically linked libraries. Also, native libraries aren’t supported in extensions at this time so you’ll probably run into issues packaging apps with this extension.

4 Likes

Thanks sir @ewpatton :pray:
Now is cleared…
Problem from my library :grinning: