Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Android studio : cannot read packageName from manifest

Tags:

java

android

xml

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')
}
like image 453
sgrumo Avatar asked Aug 08 '16 07:08

sgrumo


People also ask

How can I open manifest file in Android?

Double-click AndroidManifest. xml to open it. The Manifest specifies a range of app-level settings, including: Permissions for any device access the functionality requires, such as location, Internet access, phone calling information, and so on.

Where is the AndroidManifest xml file in Android Studio?

Every project in Android includes a Manifest XML file, which is AndroidManifest. xml, located in the root directory of its project hierarchy. The manifest file is an important part of our app because it defines the structure and metadata of our application, its components, and its requirements.


1 Answers

Try adding applicationId in defaultConfig (build.gradle):

defaultConfig {
    applicationId "com.google.vr.sdk.samples.treasurehunt"
    minSdkVersion 13
    targetSdkVersion 22
    versionCode 1
    versionName "1.0"
}
like image 126
Shaishav Avatar answered Sep 27 '22 19:09

Shaishav