Unity3d Android主活动冲突、编辑和重新编译jar

Unity3d Android主活动冲突、编辑和重新编译jar,android,unity3d,manifest,conflict,vuforia,Android,Unity3d,Manifest,Conflict,Vuforia,我正在尝试将vuforia与Unity中android的一些原生.jar插件一起使用。问题在于清单vuforia是主要活动和启动器,几乎所有“原生”android插件也希望成为清单中的主要活动 我知道你不能有两个“第一”,所以一个必须是主要的,我必须能够在另一个上启动Tactivity(),当我想使用它的时候 我已经阅读了GoogleDocs中关于制作2个活动和向显示活动传递消息的基本教程,但仍然不知道如何将其应用到我现有的2个第三方插件中 我有eclipse和android开发的所有java必

我正在尝试将vuforia与Unity中android的一些原生.jar插件一起使用。问题在于清单vuforia是主要活动和启动器,几乎所有“原生”android插件也希望成为清单中的主要活动

我知道你不能有两个“第一”,所以一个必须是主要的,我必须能够在另一个上启动Tactivity(),当我想使用它的时候

我已经阅读了GoogleDocs中关于制作2个活动和向显示活动传递消息的基本教程,但仍然不知道如何将其应用到我现有的2个第三方插件中

我有eclipse和android开发的所有java必备文件/程序,还有JD-GUI java反编译器,可以从unity.jar“插件”获取源代码

对于Vuforia,我发现了一个源java类,它说您可以编辑它以与其他本机插件一起使用,但我不知道需要添加什么,或者在哪个方法中

package com.qualcomm.QCARUnityPlayer;

import android.app.Dialog;
import android.app.NativeActivity;
import android.content.res.Configuration;
import android.graphics.PixelFormat;
import android.os.Bundle;
import android.view.KeyEvent;
import android.view.View;
import android.view.Window;
import android.view.WindowManager;

import com.unity3d.player.UnityPlayer;

/** This custom NativeActivity shows how to initialize QCAR together with Unity from an         activity.
*   If you need to integrate another native library, you can modifiy this code and 
*   compile it to a JAR file to replace QCARUnityPlayer.jar in Assets/Plugins/Android
* */
public class QCARPlayerNativeActivity extends NativeActivity {

private QCARPlayerSharedActivity mQCARShared;
protected UnityPlayer mUnityPlayer;     // don't change the name of this variable; referenced from native code

// UnityPlayer.init() should be called before attaching the view to a layout - it will load the native code.
// UnityPlayer.quit() should be the last thing called - it will unload the native code.

protected void onCreate (Bundle savedInstanceState){
    requestWindowFeature(Window.FEATURE_NO_TITLE);
    mUnityPlayer = new UnityPlayer(this);       

    super.onCreate(savedInstanceState);

    // initialize QCAR asynchronously
    mQCARShared = new QCARPlayerSharedActivity();
    int gles_mode = mUnityPlayer.getSettings().getInt("gles_mode", 1);
    mQCARShared.onCreate(this, gles_mode, new UnityInitializer());

    getWindow().takeSurface(null);
    setTheme(android.R.style.Theme_NoTitleBar_Fullscreen);
    getWindow().setFormat(PixelFormat.RGB_565);

    if (mUnityPlayer.getSettings ().getBoolean ("hide_status_bar", true))
        getWindow ().setFlags (WindowManager.LayoutParams.FLAG_FULLSCREEN,
                               WindowManager.LayoutParams.FLAG_FULLSCREEN);

}

private class UnityInitializer implements QCARPlayerSharedActivity.IUnityInitializer
{
    public void InitializeUnity()
    {
        int glesMode = mUnityPlayer.getSettings().getInt("gles_mode", 1);
        boolean trueColor8888 = false;
        mUnityPlayer.init(glesMode, trueColor8888);

        View playerView = mUnityPlayer.getView();
        setContentView(playerView);
        playerView.requestFocus();
    }
}

protected void onDestroy ()
{
    mQCARShared.onDestroy();
    mUnityPlayer.quit();
    super.onDestroy();
}

// onPause()/onResume() must be sent to UnityPlayer to enable pause and resource recreation on resume.
protected void onPause()
{
    super.onPause();
    mUnityPlayer.pause();
    mQCARShared.onPause();
}
protected void onResume()
{
    super.onResume();
    mQCARShared.onResume();
    mUnityPlayer.resume();
}
public void onConfigurationChanged(Configuration newConfig)
{
    super.onConfigurationChanged(newConfig);
    mUnityPlayer.configurationChanged(newConfig);
}
public void onWindowFocusChanged(boolean hasFocus)
{
    super.onWindowFocusChanged(hasFocus);
    mUnityPlayer.windowFocusChanged(hasFocus);
}
public boolean dispatchKeyEvent(KeyEvent event)
{
    if (event.getAction() == KeyEvent.ACTION_MULTIPLE)
        return mUnityPlayer.onKeyMultiple(event.getKeyCode(), event.getRepeatCount(), event);
    return super.dispatchKeyEvent(event);
}
}
这是我尝试使用vuforia的插件的java代码:

package com.devfo.andutils;
import android.content.Context;
import android.content.Intent;
import android.net.Uri;

public class DevfoSms {
private Context _context;

public DevfoSms(DevfoUnityPlayerActivity context){
    this._context = context;
}

public void launchSmsActivity(){
    launchSmsActivity(null, null);
}

public void launchSmsActivity(String number){
    launchSmsActivity(number, null);
}

public void launchSmsActivity(String number, String body){
    Intent smsIntent = new Intent("android.intent.action.SENDTO");
    smsIntent.setType("vnd.android-dir/mms-sms");
    if (number != null) {
    smsIntent.setData(Uri.parse("sms:" + number));
  }
  if (body != null) {
      smsIntent.putExtra("sms_body", body);
  }
      this._context.startActivity(smsIntent);
  }
}
在清单中,我有几个问题,包名称不同:

package="com.qualcomm.QCARUnityPlayer"
package="com.devfo.andutils"
这是两个相互冲突的活动

<activity android:name="com.qualcomm.QCARUnityPlayer.QCARPlayerNativeActivity"
              android:label="@string/app_name"
              android:screenOrientation="portrait"
              android:configChanges="fontScale|keyboard|keyboardHidden|locale|mnc|mcc|navigation|orientation|screenLayout|screenSize|smallestScreenSize|uiMode|touchscreen">
        <meta-data android:name="android.app.lib_name" android:value="unity" />
        <meta-data android:name="unityplayer.ForwardNativeEventsToDalvik" android:value="false" />
        <intent-filter>
            <action android:name="android.intent.action.MAIN" />
            <category android:name="android.intent.category.LAUNCHER" />
        </intent-filter>
    </activity>

而且

<activity
        android:name="com.devfo.andutils.DevfoUnityPlayerActivity"
        android:label="@string/app_name"
        android:configChanges="fontScale|keyboard|keyboardHidden|locale|mnc|mcc|navigation|orientation|screenLayout|screenSize|smallestScreenSize|uiMode|touchscreen"
        android:screenOrientation="portrait">
            <intent-filter>
                <action android:name="android.intent.action.MAIN" />
                <category android:name="android.intent.category.LAUNCHER" />
            </intent-filter>
    </activity>

我可以有两个包名,还是省略一个?谁能给我指出正确的方向吗????我试着找到一个可以雇佣的人,但唯一一个回应的人想要1800美元,然后再也没有回应。我想我有我需要的东西,但我卡住了…

试试这个:

进入Unity->File->Build Settings->Android->检查Google Android项目->导出

通过Eclipse打开导出的项目。编辑清单文件->Eclipse构建

祝你好运