-
-
Notifications
You must be signed in to change notification settings - Fork 138
Description
@bradmartin commented on Thu Feb 02 2017
Please, provide the details below:
Trying to build a plugin which is calling the following code:
public static Cancellable fromAssetFileName(Context context, String fileName, OnCompositionLoadedListener loadedListener) {
InputStream stream;
try {
stream = context.getAssets().open(fileName);
} catch (IOException e) {
throw new IllegalStateException("Unable to find file " + fileName, e);
}
return fromInputStream(context, stream, loadedListener);
}
The public method to get to that ^^^ is just accepting a string for the fileName
argument. The README for the android lib says to put the file at app/src/main/assets
. I've tried creating an assets
folder in app_resources which obviously doesn't package up there. I've tried at the root of the app
folder and no good. So is there some way to add files (this is a .json file) to that location for an android build with NS. The android code calling getAssets()
returns the AssetManager and is calling open()
with the given file name. So how do we get files to be accessible with this in a NS app is the question now that I think about it 😄
Did you verify this is a real problem by searching Stack Overflow and the other open issues in this repo?
Yes.
Which platform(s) does your issue occur on?
Android
Please provide the following version numbers that your issue occurs with:
NS 2.5 everything - just updated.
Please tell us how to recreate the issue in as much detail as possible.
Create an app, try to create an .apk with a file located in app/src/main/assets
at the output I suppose.
Is there code involved? If so, please share the minimal amount of code needed to recreate the problem.
No, just wrapping a lib.
@bradmartin commented on Thu Feb 02 2017
There is another method to go about, but was hoping to access the simplest of them with just passing the file name 👍
@bradmartin commented on Thu Feb 02 2017
And opening up platforms/android/src/main/assets
and placing the .json file isn't really a good solution for new NS devs or anyone since it'll be blasted during a build/platform clean. Doing this does work, so the native lib is expecting the file to be located in the assets
folder.