- Home /
This question was
closed Mar 14, 2016 at 02:50 PM by
EnriqueL for the following reason:
The question is answered, right answer was accepted
Question by
EnriqueL · Jul 02, 2015 at 11:11 AM ·
c#androidjavajava to c#
Error building with custom java code [Solved]
I'm doing a game that needs to access the calendar in the mobile and save an event, i've build a java code and created a .jar file using Dr. Java:
package com.company.productname;
import com.unity3d.player.UnityPlayer;
import com.unity3d.player.UnityPlayerActivity;
import java.util.Calendar;
import android.os.Bundle;
import android.app.PendingIntent;
import android.content.Intent;
import android.content.Context;
import android.util.Log;
import android.os.Handler;
public class CalendarDate {
public void addEvent(Context ctx, String title) {
//Log.d(TAG, "AddUsingIntent.addEvent()");
Intent intent = new Intent(Intent.ACTION_EDIT);
intent.setType("vnd.android.cursor.item/event");
intent.putExtra("title", title);
//intent.putExtra("beginTime", start.getTimeInMillis());
//intent.putExtra("endTime", end.getTimeInMillis());
intent.putExtra("allDay", true);
ctx.startActivity(intent);
}
}
and i've added to the mannifest:
<service android:name="es.astronauts.opengl.CalendarDate" />
to be able to access from a C# code, the code is:
#if UNITY_ANDROID
private AndroidJavaObject playerActivityContext;
#endif
// Use this for initialization
void Start () {
inicio = 2015914730;
fin = 2015914830;
#if UNITY_ANDROID && !UNITY_EDITOR
// Obtain unity context
if(playerActivityContext == null) {
AndroidJavaClass actClass = new AndroidJavaClass("com.unity3d.player.UnityPlayer");
playerActivityContext = actClass.GetStatic<AndroidJavaObject>("currentActivity");
}
AndroidJavaClass jc = new AndroidJavaClass(packageName + ".CalendarDate");
jc.CallStatic("addEvent", playerActivityContext,Title);
#endif
}
but when i build i get the next error:
can anyone help me? Thank you so much!!
errorunity.jpg
(139.6 kB)
Comment
Best Answer
Answer by EnriqueL · Jul 06, 2015 at 08:15 AM
In order to solve this issue i've created a new folder called libs (with ans s) inside the assets folder, and drooped there the java clases