[英]Android plugin in Unity
我正在嘗試從 Unity 的 android 庫中添加本地 .aar。 目前它是一個非常基本的項目,在 unity 中,只有一個腳本可以通過單擊按鈕從 android 庫中打開 Activity。
我在 /plugins/android 文件夾中手動添加了 .aar(我使用的是 2019.4 版本),並且在構建時我不斷收到找不到資源的錯誤(Theme.AppCompat.Light.NoActionBar' not found in AndroidManifest)。
這是我的 graddle 配置和 AndroidManifest:
plugins {
id 'com.android.library'
}
android {
compileSdk 31
defaultConfig {
minSdk 21
targetSdk 31
versionCode 1
versionName "1.0"
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
consumerProguardFiles "consumer-rules.pro"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
}
}
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
}
dependencies {
implementation "com.facebook.react:react-native:+"
implementation 'androidx.appcompat:appcompat:1.3.1'
implementation 'androidx.constraintlayout:constraintlayout:2.1.1'
implementation 'com.google.android.material:material:1.4.0'
testImplementation 'junit:junit:4.+'
androidTestImplementation 'androidx.test.ext:junit:1.1.3'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.4.0'
}
//(MainApplication) Manual ReactPackage Setup here...
apply from: file("../../node_modules/@react-native-community/cli-platform-android/native_modules.gradle");
applyNativeModulesAppBuildGradle(project)
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.example">
<uses-permission android:name="android.permission.INTERNET" />
<application
android:name=".MainApplication"
android:allowBackup="true"
android:usesCleartextTraffic="true"
android:supportsRtl="true"
>
<activity android:name=".MainActivity"
android:exported="true">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity android:name="com.facebook.react.devsupport.DevSettingsActivity" />
<activity
android:name=".ReactNativeActivity"
android:theme="@style/Theme.AppCompat.Light.NoActionBar"
android:configChanges="keyboard|keyboardHidden|orientation|screenSize"
android:windowSoftInputMode="adjustResize" />
</application>
</manifest>
我是移動開發的新手,但我認為問題在於 build.graddle 的依賴項未包含在 .aar 中。 我認為我的選擇是創建一個胖 .aar ,手動下載依賴項 .aar 或將 .aar 發布到中央存儲庫。 我在正確的軌道上嗎?
任何幫助都不僅僅是appriciated
我設法通過向統一項目添加自定義 graddle 模板來克服錯誤。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.