使用 Vuforia 将 Unity 项目导入 Android Studio 3.0 时出错
Error to import Unity project with Vuforia to Android Studio 3.0
我在将我的统一项目导入 Android Studio 时遇到问题:
Error:Execution failed for task ':Vuforia7SI:processDebugAndroidTestManifest'.
Manifest merger failed : Attribute application@debuggable value=(true) from manifestMerger1358168485974008065.xml:7:18-43
is also present at [:VuforiaWrapper:] AndroidManifest.xml:19:18-44 value=(false). Suggestion: add 'tools:replace="android:debuggable"' to element at manifestMerger1358168485974008065.xml:7:5-9:19 to override.
然后我使用 Vuforia 7 创建一个简单的 unity (2017.3.0f3) 项目和一个图像目标,并按以下方式导出项目:
![UnityExport][1] [1]: https://scontent.fscl1-1.fna.fbcdn.net/v/t34.0-12/26647947_10214892485526500_911683330_n.png?oh=6c754a1974af95bdb50d80a8b302d83e&oe=5A4EA6B7
所以,我在 Android Studio(3.0 版)中将文件夹作为模块导入,并修复了简单的错误(gradle 应用插件中的更改:'com.android.application' ->应用插件:'com.android.library',其他修复是更改 "compile" -> "Implementation",所有这些都在来自 unity 项目的 gradle 中)。
但是清单的问题我一直无法解决,我按照建议中的说明进行了操作:(我在清单标签中添加了下一行)
tools:replace="android:debuggable"
但是出现了一个新问题:
Error: tools:replace specified at line:15 for attribute android:debuggable, but no new value specified Vuforia7SI main manifest (this file), line 14
清单应用程序:
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
package="com.example.assertsoft.pruebaunity">
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"/>
<application
android:allowBackup="true"
android:icon="@mipmap/ic_launcher"
tools:replace="android:icon,android:theme,android:debuggable"
android:label="@string/app_name"
android:roundIcon="@mipmap/ic_launcher_round"
android:supportsRtl="true"
android:theme="@style/AppTheme">
<activity android:name=".MainActivity">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
</application>
清单统一:
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
package="com.mascayanogerardo"
android:installLocation="preferExternal"
android:versionCode="1"
android:versionName="1.0">
<supports-screens
android:anyDensity="true"
android:largeScreens="true"
android:normalScreens="true"
android:smallScreens="true"
android:xlargeScreens="true" />
<application
android:banner="@drawable/app_banner"
android:icon="@drawable/app_icon"
android:label="@string/app_name"
tools:replace="android:debuggable"
android:theme="@style/UnityThemeSelector"
>
<activity
android:name="com.mascayanogerardo.UnityPlayerActivity"
android:configChanges="mcc|mnc|locale|touchscreen|keyboard|keyboardHidden|navigation|orientation|screenLayout|uiMode|screenSize|smallestScreenSize|fontScale|layoutDirection|density"
android:label="@string/app_name"
android:launchMode="singleTask"
android:screenOrientation="portrait">
<meta-data
android:name="unityplayer.UnityActivity"
android:value="true" />
</activity>
<meta-data
android:name="unity.build-id"
android:value="b6c902c5-a74e-44f0-8501-0d21751bbb47" />
<meta-data
android:name="unity.splash-mode"
android:value="0" />
<meta-data
android:name="unity.splash-enable"
android:value="True" />
<meta-data
android:name="android.max_aspect"
android:value="2.1" />
</application>
<uses-feature android:glEsVersion="0x00020000" />
<uses-permission android:name="android.permission.CAMERA" />
<uses-feature
android:name="android.hardware.camera"
android:required="false" />
<uses-feature
android:name="android.hardware.camera.autofocus"
android:required="false" />
<uses-feature
android:name="android.hardware.camera.front"
android:required="false" />
<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>
您需要将下一行添加到您的 Unity 清单中
android:debuggable="true" //or false
这是给它一个新的值
你的 unity manifest 应该是这样的
<application
android:banner="@drawable/app_banner"
android:icon="@drawable/app_icon"
android:label="@string/app_name"
tools:replace="android:debuggable"
android:debuggable="true"
android:theme="@style/UnityThemeSelector"
>
我在将我的统一项目导入 Android Studio 时遇到问题:
Error:Execution failed for task ':Vuforia7SI:processDebugAndroidTestManifest'. Manifest merger failed : Attribute application@debuggable value=(true) from manifestMerger1358168485974008065.xml:7:18-43 is also present at [:VuforiaWrapper:] AndroidManifest.xml:19:18-44 value=(false). Suggestion: add 'tools:replace="android:debuggable"' to element at manifestMerger1358168485974008065.xml:7:5-9:19 to override.
然后我使用 Vuforia 7 创建一个简单的 unity (2017.3.0f3) 项目和一个图像目标,并按以下方式导出项目:
![UnityExport][1] [1]: https://scontent.fscl1-1.fna.fbcdn.net/v/t34.0-12/26647947_10214892485526500_911683330_n.png?oh=6c754a1974af95bdb50d80a8b302d83e&oe=5A4EA6B7
所以,我在 Android Studio(3.0 版)中将文件夹作为模块导入,并修复了简单的错误(gradle 应用插件中的更改:'com.android.application' ->应用插件:'com.android.library',其他修复是更改 "compile" -> "Implementation",所有这些都在来自 unity 项目的 gradle 中)。
但是清单的问题我一直无法解决,我按照建议中的说明进行了操作:(我在清单标签中添加了下一行)
tools:replace="android:debuggable"
但是出现了一个新问题:
Error: tools:replace specified at line:15 for attribute android:debuggable, but no new value specified Vuforia7SI main manifest (this file), line 14
清单应用程序:
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
package="com.example.assertsoft.pruebaunity">
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"/>
<application
android:allowBackup="true"
android:icon="@mipmap/ic_launcher"
tools:replace="android:icon,android:theme,android:debuggable"
android:label="@string/app_name"
android:roundIcon="@mipmap/ic_launcher_round"
android:supportsRtl="true"
android:theme="@style/AppTheme">
<activity android:name=".MainActivity">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
</application>
清单统一:
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
package="com.mascayanogerardo"
android:installLocation="preferExternal"
android:versionCode="1"
android:versionName="1.0">
<supports-screens
android:anyDensity="true"
android:largeScreens="true"
android:normalScreens="true"
android:smallScreens="true"
android:xlargeScreens="true" />
<application
android:banner="@drawable/app_banner"
android:icon="@drawable/app_icon"
android:label="@string/app_name"
tools:replace="android:debuggable"
android:theme="@style/UnityThemeSelector"
>
<activity
android:name="com.mascayanogerardo.UnityPlayerActivity"
android:configChanges="mcc|mnc|locale|touchscreen|keyboard|keyboardHidden|navigation|orientation|screenLayout|uiMode|screenSize|smallestScreenSize|fontScale|layoutDirection|density"
android:label="@string/app_name"
android:launchMode="singleTask"
android:screenOrientation="portrait">
<meta-data
android:name="unityplayer.UnityActivity"
android:value="true" />
</activity>
<meta-data
android:name="unity.build-id"
android:value="b6c902c5-a74e-44f0-8501-0d21751bbb47" />
<meta-data
android:name="unity.splash-mode"
android:value="0" />
<meta-data
android:name="unity.splash-enable"
android:value="True" />
<meta-data
android:name="android.max_aspect"
android:value="2.1" />
</application>
<uses-feature android:glEsVersion="0x00020000" />
<uses-permission android:name="android.permission.CAMERA" />
<uses-feature
android:name="android.hardware.camera"
android:required="false" />
<uses-feature
android:name="android.hardware.camera.autofocus"
android:required="false" />
<uses-feature
android:name="android.hardware.camera.front"
android:required="false" />
<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>
您需要将下一行添加到您的 Unity 清单中
android:debuggable="true" //or false
这是给它一个新的值
你的 unity manifest 应该是这样的
<application
android:banner="@drawable/app_banner"
android:icon="@drawable/app_icon"
android:label="@string/app_name"
tools:replace="android:debuggable"
android:debuggable="true"
android:theme="@style/UnityThemeSelector"
>