gpt4 book ai didi

android - Android Studio在错误的文件夹中寻找AndroidManifest.xml

转载 作者:行者123 更新时间:2023-12-03 05:32:55 26 4
gpt4 key购买 nike

我有一个问题,我从本地git仓库下载的项目无法为我编译。

我得到的错误是

GradeExemption not found

更重要的是:

错误:无法从D:\Source Code\The Project - Android\src\main\AndroidManifest.xml 中读取packageName

但是,AndroidManifest位于 D:\Source Code\The Project - Android\app\src\main\AndroidManifest.xml,我不确定如何使解决方案能够看到这一点。
我已经检查了Project-Android.iml文件,它具有:
<?xml version="1.0" encoding="UTF-8"?>
<module external.linked.project.id=":" external.linked.project.path="D:\Source Code\The Project - Android" external.root.project.path="$MODULE_DIR$" external.system.id="GRADLE" type="JAVA_MODULE" version="4">
<component name="FacetManager">
<facet type="android-gradle" name="Android-Gradle">
<configuration>
<option name="GRADLE_PROJECT_PATH" value=":" />
<option name="LAST_SUCCESSFUL_SYNC_AGP_VERSION" />
<option name="LAST_KNOWN_AGP_VERSION" />
</configuration>
</facet>
</component>
<component name="NewModuleRootManager" inherit-compiler-output="true">
<exclude-output />
<content url="file://$MODULE_DIR$" />
<orderEntry type="jdk" jdkName="1.8" jdkType="JavaSDK" />
<orderEntry type="sourceFolder" forTests="false" />
</component>
</module>

如果需要,我的Android Studio版本是3.5.1,成绩模型版本是4.1,NDK版本是UNKNOWN。

我试图打开项目,导入项目,从SVN重新下载它,重新安装Android Studio,并使缓存无效。

我通过用 GradleException替换 GradleException来“修复”找不到 FileNotFoundException错误,但是您对如何解决 AndroidManifest.xml问题有任何想法吗?

编辑:
根据要求,manifest.xml应用程序:
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.foo.theproject">

<uses-permission android:name="android.permission.CALL_PHONE" android:required="false"/>
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE"/>
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE"/>
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"/>
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION"/>
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION"/>
<uses-permission android:name="android.permission.CAMERA"/>

<uses-feature android:name="android.hardware.telephony" android:required="false"/>

<supports-screens
android:anyDensity="true"
android:xlargeScreens="true"
android:largeScreens="true"
android:normalScreens="true"
android:smallScreens="true" />

<application
android:name="com.foo.base.cmApplication"
android:allowBackup="true"
android:icon="@mipmap/dvw_icon"
android:label="@string/app_name"
android:supportsRtl="true"
android:windowSoftInputMode="adjustPan"
android:theme="@style/AppTheme">
<activity
android:name=".LoginActivity"
android:windowSoftInputMode="adjustPan"
android:label="@string/app_name">
<intent-filter>
<action android:name="android.intent.action.MAIN" />

<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>


<meta-data
android:name="io.fabric.ApiKey"
android:value="2cec7d652dd91e36e052e9cbee7cf8d215043ad2" />

<activity
android:name=".TaskView"
android:label="DVW"
android:windowSoftInputMode="adjustPan"
android:theme="@style/AppTheme.NoActionBar"></activity>
<activity
android:name=".TabletLayoutActivity"
android:label="DVW"
android:windowSoftInputMode="adjustPan"
android:theme="@style/AppTheme.NoActionBar"></activity>
<activity
android:name=".PhoneLayoutActivity"
android:label="DVW"
android:windowSoftInputMode="adjustPan"
android:theme="@style/AppTheme.NoActionBar"></activity>
<!--<activity-->
<!--android:name=".MainActivity"-->
<!--android:label="DVW"-->
<!--android:theme="@style/AppTheme.NoActionBar"></activity>-->
</application>

</manifest>

编辑2:
全局build.gradle
// Top-level build file where you can add configuration options common to all sub-projects/modules.
apply plugin: 'com.android.library'

android {
signingConfigs {
}
compileSdkVersion 26
buildToolsVersion '26.0.0'
defaultConfig {
minSdkVersion 19
targetSdkVersion 26
versionCode 1
versionName "1.0"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
packagingOptions {
exclude 'META-INF/NOTICE'
exclude 'META-INF/LICENSE'
}
}

repositories {
maven { url 'https://maven.fabric.io/public' }
}

dependencies {
compile fileTree(include: ['*.jar'], dir: 'libs')
testCompile 'junit:junit:4.12'
compile 'commons-io:commons-io:2.4'
compile 'commons-codec:commons-codec:1.9'
compile 'com.kyanogen.signatureview:signature-view:1.1@aar'
compile files('libs/FlexiCoreProvider-1.7p7.signed.jar')
//compile 'com.android.support:appcompat-v7:23.1.1'
compile('com.crashlytics.sdk.android:crashlytics:2.5.5@aar') {
transitive = true;
}
compile 'org.apache.httpcomponents:httpclient-android:4.3.5.1'
compile('org.apache.httpcomponents:httpmime:4.3') {
exclude module: "httpclient"
}
//compile 'com.android.support:design:23.1.1'
}

buildscript {
repositories {
google()
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.0.1'


// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}

allprojects {
repositories {
jcenter()
}
}

android {
sourceSets {
main {
manifest.srcFile 'app/src/main/AndroidManifest.xml'
}
}
}

/ app build.gradle
buildscript {
repositories {
maven { url 'https://maven.fabric.io/public' }
}

dependencies {
classpath 'io.fabric.tools:gradle:1.+'
}
}
apply plugin: 'com.android.application'
apply plugin: 'io.fabric'

repositories {
maven { url 'https://maven.fabric.io/public' }
}

def baseVersion = "2.6."

android {
compileSdkVersion 'Google Inc.:Google APIs:23'
buildToolsVersion '26.0.2'
def versionPropsFile = file('version.properties')
sourceSets {
main {
manifest.srcFile 'app/src/main/AndroidManifest.xml'
}
}
if (versionPropsFile.canRead()) {
Properties versionProps = new Properties()
versionProps.load(new FileInputStream(versionPropsFile))
def code = versionProps['VERSION_CODE'].toInteger() + 1

versionProps['VERSION_CODE'] = code.toString()
versionProps.store(versionPropsFile.newWriter(), null)

defaultConfig {
applicationId "com.dryerventwizard.techwizard"
minSdkVersion 19
targetSdkVersion 26
versionCode code
versionName baseVersion + code
}
} else {
//throw new GradleException("Could not read version.properties!")
throw new FileNotFoundException("Could not read version.properties!")
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
packagingOptions {
pickFirst 'META-INF/LICENSE.txt'
pickFirst 'META-INF/NOTICE.txt'
exclude 'META-INF/NOTICE'
exclude 'META-INF/NOTICE.txt'
exclude 'META-INF/LICENSE'
exclude 'META-INF/LICENSE.txt'
}
lintOptions {
checkReleaseBuilds false
abortOnError false
}
}

dependencies {
compile fileTree(include: ['*.jar'], dir: 'libs')
testCompile 'junit:junit:4.12'
compile 'com.squareup.retrofit2:retrofit:2.0.0-beta4'
compile 'org.apache.commons:commons-lang3:3.4'
compile 'com.android.support:design:23.1.1'
compile 'commons-io:commons-io:2.4'
compile 'com.android.support:appcompat-v7:23.1.0'
compile 'com.google.android.gms:play-services-location:8.4.0'
compile('com.crashlytics.sdk.android:crashlytics:2.5.5@aar') { transitive = true; }
compile project(':..:LMBoot:lmboot')
}

gradle.buildFinished {
buildResult ->
println ""
println "BUILD FINISHED"
println ""

def versionPropsFile = file('version.properties')
if (versionPropsFile.canRead()) {
Properties versionProps = new Properties()
versionProps.load(new FileInputStream(versionPropsFile))
def code = versionProps['VERSION_CODE'].toInteger()
println("Version " + baseVersion + code.toString())
}
}

编辑3:
试图与文件流同步,并与gradle同步,没有变化。
用compileSdkVersion 26替换compileSdkVersion'Google Inc.:Google APIs:26',以清除找不到'Google Inc.:Google APIs:26'错误。

编辑4:
如果我将应用程序包含在 manifest.srcFile app/src/main/AndroidManifest.xml中,它将在 app/app/src/main/AndroidManifest.xml中查找xml文件。
如果删除该应用程序,它将在 /src/main/AndroidManifest.xml中查找文件。

最佳答案

转到文件->使用Gradle文件同步项目。

关于android - Android Studio在错误的文件夹中寻找AndroidManifest.xml,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/58303409/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com