- Home /
How do I use the Android Library in Unity?
Hi,Can someone point me on how to use android library project with unity..?I created a library project in eclipse.I need to use it as a Android Library Project not just the jar file in the plugin/Android folder.The folder structure will be like
--Plugins
--Android
--MyLibraryProject
--Src
--res
--bin
--libs
Now how can I access the Java class if my library package name is com.company.product and the class activity name is MyActivity
It tried this
private static AndroidJavaClass Javaclass = new AndroidJavaClass("com.company.Product.MyActivity");
private static AndroidJavaObject JavaObj = Javaclass.GetStatic<AndroidJavaObject>("_activity");
//where the _activity reference is got from bundle creator in the Libraryproject java file
public static Activity _activity;
@Override
protected void onCreate(Bundle savedInstanceState)
{
//Get the current activity
_activity = Activity;
}
but this gives me the java class and object as null
Any help would be appreciated.
Your answer
Follow this Question
Related Questions
AndroidJavaException - java.lang.ClassNotFoundException 1 Answer
correct approach for using e.g. three android plugins 0 Answers
Android build crashes on start up. 2 Answers
Get Phone number of android mobile device - Android native code to Unity c# 3 Answers
CommandInvokationFailure: Gradle build failed. unity 2019.4.22 1 Answer