sgrumo
sgrumo

Reputation: 665

Android studio : cannot read packageName from manifest

Hi everyone ( this is my first question, please don't be rude ). I'm a beginner in coding and I have ran into this error in Android Studio : "Gradle project sync failed", and the error is "Error:Cannot read packageName from /Users/sgrumo/Downloads/gvr-android-sdk-master/samples/sdk-treasurehunt/src/main/AndroidManifest.xml"

My manifest is the following :

<?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')
}

Upvotes: 6

Views: 23853

Answers (2)

dcarl661
dcarl661

Reputation: 322

I have wrestled with this for weeks (on and off) while building a new build computer.
I have multiple android telemetry apps that share a common library. Somehow in this process a build.gradle got moved into the base source directory. So I deleted the build.gradle that was outside the project subdirectories and that fixed my problem.
Some how android studio was evaluating the build.gradle outside the actual project directories.

Upvotes: 0

Shaishav
Shaishav

Reputation: 5312

Try adding applicationId in defaultConfig (build.gradle):

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

Upvotes: 19

Related Questions