Android studio:无法从清单中读取packageName

时间:2016-08-08 07:47:54

标签: java android xml

大家好(这是我的第一个问题,请不要粗鲁)。 我是编码的初学者,我在Android Studio中遇到了这个错误: " Gradle项目同步失败",错误是"错误:无法从/ Users / sgrumo / Downloads / gvr-android-sdk-master / samples / sdk-treasurehunt / src / main读取packageName /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>

build.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')
}

1 个答案:

答案 0 :(得分:15)

尝试在applicationIddefaultConfig)中添加build.gradle

defaultConfig {
    applicationId "com.google.vr.sdk.samples.treasurehunt"
    minSdkVersion 13
    targetSdkVersion 22
    versionCode 1
    versionName "1.0"
}