[英]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.