如何扩展UnityPlayerActivity

时间:2019-03-15 23:14:43

标签: android unity3d gradle plugins android-manifest

我正在尝试扩展UnityPlayerActivity。我正在使用android studio 3.2.1。我从统一复制了classes.jar到我的android studio项目中的libs文件夹中。我已将其添加为库。现在的问题是,当我打开我的应用程序时,它立即关闭。我认为我的gradle可能出了点问题,但我不知道如何解决。它也可能是软件包的名称。我不确定它们是否需要相同,但是我的android项目当前的软件包名称不同于我的unity项目。我之前从未扩展过UnityPlayerActivity,所以我确定我缺少简单的东西。

这是我的礼物:

apply plugin: 'com.android.library'

android {
compileSdkVersion 27

defaultConfig {
    minSdkVersion 16
    targetSdkVersion 27
    versionCode 1
    versionName "1.0"
    testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}
buildTypes {
    release {
        minifyEnabled false
        proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
    }
}

lintOptions { abortOnError false }
}

dependencies {
  implementation fileTree(include: ['*.jar'], dir: 'libs')
  testImplementation 'junit:junit:4.12'
  androidTestImplementation 'com.android.support.test:runner:1.0.2'
  androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.2'
  implementation files('libs/classes.jar')
}

task deleteOldJar(type: Delete) { delete 'libs/LRA2n1Activity.jar' }
task exportJar(type: Copy) { from('build/intermediates/intermediate- 
jars/release/') into('libs/') include('classes.jar')
rename('classes.jar', 'LRA2n1Activity.jar') }

这是我的清单:

  <?xml version="1.0" encoding="utf-8"?>
   <manifest xmlns:android="http://schemas.android.com/apk/res/android" 
    package="com.Immersion.LRA2n1" 
    xmlns:tools="http://schemas.android.com/tools" 
    android:installLocation="preferExternal">
  <supports-screens android:smallScreens="true" android:normalScreens="true" 
    android:largeScreens="true" android:xlargeScreens="true" 
    android:anyDensity="true" />
 <application android:theme="@style/UnityThemeSelector" 
    android:icon="@mipmap/app_icon" android:label="@string/app_name" 
    android:isGame="true" android:banner="@drawable/app_banner">
 <activity android:label="@string/app_name" 
    android:screenOrientation="fullSensor" android:launchMode="singleTask" 


android:configChanges="mcc|mnc|locale|touchscreen|keyboard|keyboardHidden|navigation|orientation|screenLayout|uiMode|screenSize|smallestScreenSize|fontScale|layoutDirection|density" android:hardwareAccelerated="false" android:name=".LRA2n1Activity">


     <intent-filter>
        <action android:name="android.intent.action.MAIN" />
        <category android:name="android.intent.category.LAUNCHER" />
        <category android:name="android.intent.category.LEANBACK_LAUNCHER" />
      </intent-filter>
      <meta-data android:name="unityplayer.UnityActivity" android:value="true" />
    </activity>
    <meta-data android:name="unity.build-id" android:value="aeaded6f-49da-43d8-8b73-64c29a199a12" />
    <meta-data android:name="unity.splash-mode" android:value="0" />
    <meta-data android:name="unity.splash-enable" android:value="True" />
  </application>
  <uses-feature android:glEsVersion="0x00020000" />
  <uses-permission android:name="android.permission.INTERNET" />
  <uses-permission android:name="android.permission.VIBRATE" />
  <uses-feature android:name="android.hardware.touchscreen" android:required="false" />
  <uses-feature android:name="android.hardware.touchscreen.multitouch" android:required="false" />
  <uses-feature android:name="android.hardware.touchscreen.multitouch.distinct" android:required="false" />
</manifest>

任何人和所有帮助将不胜感激。

0 个答案:

没有答案