Android的插件统一给错误 [英] Android Plugin for Unity giving errors
问题描述
我在做一个测试应用程序,以了解我们如何通过插件凸轮使用java code团结。
i was doing a test application to learn how we cam use java code in unity through Plugin.
我创建在Eclipse中使用的是Android 3.2的简单的Android Activity类。
I created a simple Android Activity class using Android 3.2 in eclipse.
package com.control.unitycontrol;
import com.unity3d.player.UnityPlayerActivity;
import android.os.Bundle;
import android.util.Log;
import android.widget.Toast;
public class MainActivity extends UnityPlayerActivity {
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
Log.d("TEST","Foo method is called is called 1111");
}
public static void foo(){
Log.d("TEST","Foo method is called is called 2222"); // this method is never called
}}
下面是我的AndroidManifest.xml
Here is my AndroidManifest.xml
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.control.unitycontrol"
android:versionCode="1"
android:versionName="1.0" >
<uses-sdk
android:minSdkVersion="8"
android:targetSdkVersion="15" />
<application
android:icon="@drawable/ic_launcher"
android:label="@string/app_name"
android:theme="@style/AppTheme" >
<activity
android:name=".MainActivity"
android:label="@string/title_activity_main"
android:configChanges="fontScale|keyboard|keyboardHidden|locale|mnc|mcc|navigation|orientation|screenLayout|screenSize|smallestScreenSize|uiMode|touchscreen">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
</application>
</manifest>
据我复制classes.jar我libs文件夹,然后将它添加到我的类路径教程。
According to the tutorial I copied classes.jar to my libs folder then added it to my classpath..
然后我做我的项目就是图书馆。
then I made my project "Is Library ".
最后,我将我的unitycontrol.jar与AndroidManifest.xml中一起Assests->插件 - > Android的文件夹中。
Finally I added my unitycontrol.jar to Assests->Plugins->Android folder along with the AndroidManifest.xml.
要访问我的code在C#剧本我写的。
To Access my code in C# script I wrote.
using (AndroidJavaClass cls_UnityPlayer = new AndroidJavaClass("com.unity3d.player.UnityPlayer"))
{
using (AndroidJavaObject obj_Activity = cls_UnityPlayer.GetStatic<AndroidJavaObject>("currentActivity"))
{
obj_Activity .CallStatic("foo");
}
}
当我玩我的场景我得到的错误说:
When i play my scene I get error saying:
JNI:无法找到'currentActivity'id字段(静态)
UnityEngine.AndroidJavaObject:GetStatic(字符串)的
JNI: Unable to find field id for 'currentActivity' (static) UnityEngine.AndroidJavaObject:GetStatic(String)
如果我尝试构建它,我得到错误说:
If I try to build it I get error saying :
*的无法重新封装资源使用以下参数:
包-v -f -m -J根-M AndroidManifest.xml中-SRES-IC:/用户/ SUMIT /文档/ Android的SDK窗口/平台/ Android的16 \\的android.jar-F斌/ resources.ap_
配置:*
任何帮助... !!!我能做些什么解决这个问题。
Any Help ...!!! What can I do resolve this Issue
推荐答案
从应用程序标记删除图标/主题/标签,肯定是工作。
remove icon/theme/label from application tag, definitely work.
这篇关于Android的插件统一给错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!