Description
In a custom android module having images in assets directory in which getting any image in Kroll.method using "context.getAssets().open("sample.jpg");" when installed to any blank android project it runs perfectly for the first time after cleaning it but again if try to install without cleaning it will not be able to find the file this time.
Steps to Reproduce
1. Create a Titanium Module Project and put any image in assets directory.
2. In "example" @Kroll.method put this code :
try {
InputStream is = context.getAssets().open("sample.jpg");
Log.d(LCAT, "inputstream=="+is);
} catch (IOException e) {
e.printStackTrace();
}
3. Install this module in Titanium android project.
4. Clean the project and then install and run it.(It will run successfully this time)
5. Now install the project again without cleaning it first, and run it again.(This time it will not be able to find the file)
Error Logs
java.io.FileNotFoundException: sample.jpg
W/System.err( 957): at android.content.res.AssetManager.openAsset(Native Method)
W/System.err( 957): at android.content.res.AssetManager.open(AssetManager.java:315)
W/System.err( 957): at android.content.res.AssetManager.open(AssetManager.java:289)
W/System.err( 957): at ti.gl.imagemod.SampleimagemodModule.example(SampleimagemodModule.java:55)
W/System.err( 957): at org.appcelerator.kroll.runtime.v8.V8Runtime.nativeRunModule(Native Method)
W/System.err( 957): at org.appcelerator.kroll.runtime.v8.V8Runtime.doRunModule(V8Runtime.java:140)
W/System.err( 957): at org.appcelerator.kroll.KrollRuntime.handleMessage(KrollRuntime.java:289)
W/System.err( 957): at org.appcelerator.kroll.runtime.v8.V8Runtime.handleMessage(V8Runtime.java:166)
W/System.err( 957): at android.os.Handler.dispatchMessage(Handler.java:95)
W/System.err( 957): at android.os.Looper.loop(Looper.java:137)
W/System.err( 957): at org.appcelerator.kroll.KrollRuntime$KrollRuntimeThread.run(KrollRuntime.java:112)
Is this a emulator or device build? Is there a test project that demonstrates the problem?
Hi Chris, Tested on device.
Unable to reproduce with Titanium SDK 5.5.0. Note that the steps to reproduce have changed. Now you must add the following imports:
and then change the test code inside your KrollModule implementation:
When testing, I see:
Closing ticket as the issue cannot be reproduced.