Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Images are not accessible using the context.getClassLoader.getResaurceAsStream from android jar in Unity plugin

I am trying to create an SDK in which i have few images and all the classes in .jar file.

I have already created the unity plugin and bridge class for android SDK. Functionality is working all fine in SDK. But i am facing the below problem, I am creating all the view programetically in this SDK,

In native android it is working fine. Images are accessible using the context.getClassLoader.getResourceAsStream method and i get the InputStream of image well and image is showing when view is created.

But when i call the SDK from the unity plugin and android-bridge class i am getting null as InputStream.

Does anyone has any idea about this? And how to solve this. Thanks in Advance.

like image 727
Hardik Chauhan Avatar asked Dec 18 '15 11:12

Hardik Chauhan


1 Answers

You need to copy your images to assets and use getAssets().open("yourimage.jpg").


Source:

Android files in jar library not accessible when using with Unity

Android files in jar library not accessible when using with Unity - Please help

like image 153
Jared Rummler Avatar answered Nov 14 '22 15:11

Jared Rummler