[英]Android studio : cannot read packageName from manifest
大家好(這是我的第一個問題,請不要粗魯)。 我是編碼初學者,我在 Android Studio 中遇到了這個錯誤:“Gradle 項目同步失敗”,錯誤是“錯誤:無法從 /Users/sgrumo/Downloads/gvr-android-sdk-master 讀取 packageName /samples/sdk-treasurehunt/src/main/AndroidManifest.xml"
我的清單如下:
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.google.vr.sdk.samples.treasurehunt"
android:versionCode="1"
android:versionName="1">
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.NFC" />
<uses-permission android:name="android.permission.VIBRATE" />
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />
<!-- Make accelerometer and gyroscope hard requirements for good head tracking. -->
<uses-feature android:name="android.hardware.sensor.accelerometer" android:required="true"/>
<uses-feature android:name="android.hardware.sensor.gyroscope" android:required="true"/>
<uses-sdk android:minSdkVersion="19" android:targetSdkVersion="22"/>
<uses-feature android:glEsVersion="0x00020000" android:required="true" />
<!-- VR feature tags. -->
<uses-feature android:name="android.software.vr.mode" android:required="false"/>
<uses-feature android:name="android.hardware.vr.high_performance" android:required="false"/>
<uses-feature android:name=""
<application
android:allowBackup="true"
android:supportsRtl="true"
android:icon="@drawable/ic_launcher"
android:label="@string/app_name">
<activity
android:name="com.google.vr.sdk.samples.treasurehunt.TreasureHuntActivity"
android:label="@string/app_name"
android:screenOrientation="landscape"
android:configChanges="orientation|keyboardHidden|screenSize" >
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
<category android:name="com.google.intent.category.CARDBOARD" />
</intent-filter>
</activity>
</application>
</manifest>
構建.gradle:
apply plugin: 'com.android.application'
android {
compileSdkVersion 23
buildToolsVersion "23.0.1"
defaultConfig {
minSdkVersion 13
targetSdkVersion 22
versionCode 1
versionName "1.0"
}
splits {
abi {
enable true
reset()
include 'x86', 'armeabi-v7a'
universalApk true
}
}
}
dependencies {
compile project(':libraries-audio')
compile project(':libraries-base')
compile project(':libraries-common')
}
嘗試在defaultConfig
( build.gradle
) 中添加applicationId
:
defaultConfig {
applicationId "com.google.vr.sdk.samples.treasurehunt"
minSdkVersion 13
targetSdkVersion 22
versionCode 1
versionName "1.0"
}
在構建新構建的計算機時,我已經為此努力了數周(斷斷續續)。
我有多個共享一個公共庫的 android 遙測應用程序。 在這個過程中,一個 build.gradle 不知何故被移動到了基本的源目錄中。 所以我刪除了項目子目錄之外的 build.gradle 並解決了我的問題。
一些 android studio 如何評估實際項目目錄之外的 build.gradle。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.