我可以使用./gradlew:app:assemblereRease
构建应用程序,但这实际上并不能解决问题,它只是一种变通方法。之后,我在/app/build/outputs/apk/release
中找到apk,并在终端中使用apksigner
手动签署apk。如果有人读到这篇文章:但没有找到解决这个问题的方法,那么这是一个可行的变通方法(尽管它不是一个解决方法)。要手动签署apk,搜索“build your app from the command line”,就会出现一个Android developers页面,解释如何这样做。
每次尝试构建时,它都是“:GenerateDebugBuildConfig”,而不是“app:GenerateDebugBuildConfig”。
Execution failed for task ':generateDebugBuildConfig'.
> Failed to calculate the value of task ':generateDebugBuildConfig' property 'buildConfigPackageName'.
> Failed to query the value of property 'packageName'.
> Manifest file does not exist: /home/android-studio/Documents/your_android_app/src/main/AndroidManifest.xml
这个问题似乎和这个问题完全一样:
无法读取packageName“:GenerateDebugBuildConfig”
但没有得到答复。
这是由于生成运行的是“:GenerateDebugBuildConfig”而不是“:App:GenerateDebugBuildConfig”
我在网上找不到任何关于这一点的东西,除了我链接到的问题(没有解决方案)。
不是这个BUG,一个显示在图形UI中,而这个显示在构建输出中。(再加上我在那里尝试了大部分的解决方案,都没有奏效)。
显示由于某种原因不应用于生成的运行配置的图像
对于Build,我根本无法这样做,因此我无法使用它。这样做的问题是,如果构建不起作用,我就无法生成一个签名的apk。
谢谢你的帮助。
// Top-level build file where you can add configuration options common to all sub-projects/modules.
apply plugin: 'com.android.application'
apply plugin: 'kotlin-android'
apply plugin: 'kotlin-parcelize'
android {
compileSdkVersion 30
buildToolsVersion "30.0.2"
defaultConfig {
applicationId "com.mapitall.SwiftAddress"
minSdkVersion 21
targetSdkVersion 30
versionCode 1
versionName "0.0.1"
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
}
}
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
kotlinOptions {
jvmTarget = '1.8'
}
}
buildscript {
ext.kotlin_version = "1.4.20"
repositories {
google()
jcenter()
}
dependencies {
classpath "com.android.tools.build:gradle:4.1.1"
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
allprojects {
repositories {
html" target="_blank">google()
jcenter()
maven { url "https://jitpack.io"}
}
}
plugins {
id 'com.android.application'
id 'kotlin-android'
id 'kotlin-parcelize'
}
android {
compileSdkVersion 30
buildToolsVersion "30.0.2"
defaultConfig {
applicationId "com.mapitall.SwiftAddress"
minSdkVersion 21
targetSdkVersion 30
versionCode 1
versionName "0.0.1"
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
}
}
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
kotlinOptions {
jvmTarget = '1.8'
}
}
repositories {
mavenCentral()
}
dependencies {
implementation "org.jetbrains.kotlin:kotlin-stdlib:1.4.21"
implementation 'androidx.core:core-ktx:1.3.2'
implementation 'androidx.appcompat:appcompat:1.2.0'
implementation 'com.google.android.material:material:1.2.1'
implementation 'androidx.constraintlayout:constraintlayout:2.0.4'
testImplementation 'junit:junit:4.13.1'
androidTestImplementation 'androidx.test.ext:junit:1.1.2'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.3.0'
implementation 'org.osmdroid:osmdroid-android:6.1.8'
implementation 'com.github.MKergall:osmbonuspack:6.6.0'
implementation 'androidx.preference:preference:1.1.1'
}
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.mapitall.SwiftAddress"
android:versionCode="1"
android:versionName="0.1">
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
<uses-permission android:name="android.permission.VIBRATE" />
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.INTERNET"/>
<application
android:allowBackup="true"
android:icon="@mipmap/ic_launcher"
android:label="@string/app_name"
android:roundIcon="@mipmap/ic_launcher_round"
android:supportsRtl="true"
android:theme="@style/Theme.KeypadMapper4">
<activity android:name="com.mapitall.SwiftAddress.ChooseBackgroundImagery" />
<activity android:name="com.mapitall.SwiftAddress.Keypad" />
<activity android:name="com.mapitall.SwiftAddress.MainActivity">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
</application>
</manifest>
下面是尝试使用Gradle在terminal中构建应用程序后的stacktrace:
> Task :generateDebugBuildConfig FAILED
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':generateDebugBuildConfig'.
> Failed to calculate the value of task ':generateDebugBuildConfig' property 'buildConfigPackageName'.
> Failed to query the value of property 'packageName'.
> Manifest file does not exist: /home/android-studio/Documents/SwiftAddress2/src/main/AndroidManifest.xml
* Try:
Run with --info or --debug option to get more log output. Run with --scan to get full insights.
* Exception is:
org.gradle.api.tasks.TaskExecutionException: Execution failed for task ':generateDebugBuildConfig'.
at org.gradle.api.internal.tasks.execution.CatchExceptionTaskExecuter.execute(CatchExceptionTaskExecuter.java:38)
at org.gradle.api.internal.tasks.execution.EventFiringTaskExecuter$1.executeTask(EventFiringTaskExecuter.java:77)
at org.gradle.api.internal.tasks.execution.EventFiringTaskExecuter$1.call(EventFiringTaskExecuter.java:55)
at org.gradle.api.internal.tasks.execution.EventFiringTaskExecuter$1.call(EventFiringTaskExecuter.java:52)
at org.gradle.internal.operations.DefaultBuildOperationExecutor$CallableBuildOperationWorker.execute(DefaultBuildOperationExecutor.java:409)
at org.gradle.internal.operations.DefaultBuildOperationExecutor$CallableBuildOperationWorker.execute(DefaultBuildOperationExecutor.java:399)
at org.gradle.internal.operations.DefaultBuildOperationExecutor$1.execute(DefaultBuildOperationExecutor.java:157)
at org.gradle.internal.operations.DefaultBuildOperationExecutor.execute(DefaultBuildOperationExecutor.java:242)
at org.gradle.internal.operations.DefaultBuildOperationExecutor.execute(DefaultBuildOperationExecutor.java:150)
at org.gradle.internal.operations.DefaultBuildOperationExecutor.call(DefaultBuildOperationExecutor.java:94)
at org.gradle.internal.operations.DelegatingBuildOperationExecutor.call(DelegatingBuildOperationExecutor.java:36)
at org.gradle.api.internal.tasks.execution.EventFiringTaskExecuter.execute(EventFiringTaskExecuter.java:52)
at org.gradle.execution.plan.LocalTaskNodeExecutor.execute(LocalTaskNodeExecutor.java:41)
at org.gradle.execution.taskgraph.DefaultTaskExecutionGraph$InvokeNodeExecutorsAction.execute(DefaultTaskExecutionGraph.java:356)
at org.gradle.execution.taskgraph.DefaultTaskExecutionGraph$InvokeNodeExecutorsAction.execute(DefaultTaskExecutionGraph.java:343)
at org.gradle.execution.taskgraph.DefaultTaskExecutionGraph$BuildOperationAwareExecutionAction.execute(DefaultTaskExecutionGraph.java:336)
at org.gradle.execution.taskgraph.DefaultTaskExecutionGraph$BuildOperationAwareExecutionAction.execute(DefaultTaskExecutionGraph.java:322)
at org.gradle.execution.plan.DefaultPlanExecutor$ExecutorWorker.lambda$run$0(DefaultPlanExecutor.java:127)
at org.gradle.execution.plan.DefaultPlanExecutor$ExecutorWorker.execute(DefaultPlanExecutor.java:191)
at org.gradle.execution.plan.DefaultPlanExecutor$ExecutorWorker.executeNextNode(DefaultPlanExecutor.java:182)
at org.gradle.execution.plan.DefaultPlanExecutor$ExecutorWorker.run(DefaultPlanExecutor.java:124)
at org.gradle.internal.concurrent.ExecutorPolicy$CatchAndRecordFailures.onExecute(ExecutorPolicy.java:64)
at org.gradle.internal.concurrent.ManagedExecutorImpl$1.run(ManagedExecutorImpl.java:48)
at org.gradle.internal.concurrent.ThreadFactoryImpl$ManagedThreadRunnable.run(ThreadFactoryImpl.java:56)
Caused by: org.gradle.api.internal.provider.AbstractProperty$PropertyQueryException: Failed to calculate the value of task ':generateDebugBuildConfig' property 'buildConfigPackageName'.
at org.gradle.api.internal.provider.AbstractProperty.finalizeNow(AbstractProperty.java:239)
at org.gradle.api.internal.provider.AbstractProperty.beforeRead(AbstractProperty.java:230)
at org.gradle.api.internal.provider.AbstractProperty.calculatePresence(AbstractProperty.java:56)
at org.gradle.api.internal.provider.AbstractMinimalProvider.isPresent(AbstractMinimalProvider.java:74)
at org.gradle.api.internal.tasks.properties.bean.AbstractNestedRuntimeBeanNode$BeanPropertyValue.call(AbstractNestedRuntimeBeanNode.java:137)
at org.gradle.api.internal.tasks.properties.AbstractValidatingProperty.validate(AbstractValidatingProperty.java:39)
at org.gradle.api.internal.tasks.properties.DefaultTaskProperties.validate(DefaultTaskProperties.java:193)
at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter$TaskExecution.validate(ExecuteActionsTaskExecuter.java:506)
at org.gradle.internal.execution.steps.ValidateStep.execute(ValidateStep.java:50)
at org.gradle.internal.execution.steps.SkipEmptyWorkStep.lambda$execute$2(SkipEmptyWorkStep.java:78)
at org.gradle.internal.execution.steps.SkipEmptyWorkStep.execute(SkipEmptyWorkStep.java:78)
at org.gradle.internal.execution.steps.SkipEmptyWorkStep.execute(SkipEmptyWorkStep.java:34)
at org.gradle.internal.execution.steps.legacy.MarkSnapshottingInputsStartedStep.execute(MarkSnapshottingInputsStartedStep.java:39)
at org.gradle.internal.execution.steps.LoadExecutionStateStep.execute(LoadExecutionStateStep.java:40)
at org.gradle.internal.execution.steps.LoadExecutionStateStep.execute(LoadExecutionStateStep.java:28)
at org.gradle.internal.execution.impl.DefaultWorkExecutor.execute(DefaultWorkExecutor.java:33)
at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.executeIfValid(ExecuteActionsTaskExecuter.java:194)
at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.execute(ExecuteActionsTaskExecuter.java:186)
at org.gradle.api.internal.tasks.execution.CleanupStaleOutputsExecuter.execute(CleanupStaleOutputsExecuter.java:114)
at org.gradle.api.internal.tasks.execution.FinalizePropertiesTaskExecuter.execute(FinalizePropertiesTaskExecuter.java:46)
at org.gradle.api.internal.tasks.execution.ResolveTaskExecutionModeExecuter.execute(ResolveTaskExecutionModeExecuter.java:62)
at org.gradle.api.internal.tasks.execution.SkipTaskWithNoActionsExecuter.execute(SkipTaskWithNoActionsExecuter.java:57)
at org.gradle.api.internal.tasks.execution.SkipOnlyIfTaskExecuter.execute(SkipOnlyIfTaskExecuter.java:56)
at org.gradle.api.internal.tasks.execution.CatchExceptionTaskExecuter.execute(CatchExceptionTaskExecuter.java:36)
at org.gradle.api.internal.tasks.execution.EventFiringTaskExecuter$1.executeTask(EventFiringTaskExecuter.java:77)
at org.gradle.api.internal.tasks.execution.EventFiringTaskExecuter$1.call(EventFiringTaskExecuter.java:55)
at org.gradle.api.internal.tasks.execution.EventFiringTaskExecuter$1.call(EventFiringTaskExecuter.java:52)
at org.gradle.internal.operations.DefaultBuildOperationExecutor$CallableBuildOperationWorker.execute(DefaultBuildOperationExecutor.java:409)
at org.gradle.internal.operations.DefaultBuildOperationExecutor$CallableBuildOperationWorker.execute(DefaultBuildOperationExecutor.java:399)
at org.gradle.internal.operations.DefaultBuildOperationExecutor$1.execute(DefaultBuildOperationExecutor.java:157)
at org.gradle.internal.operations.DefaultBuildOperationExecutor.execute(DefaultBuildOperationExecutor.java:242)
at org.gradle.internal.operations.DefaultBuildOperationExecutor.execute(DefaultBuildOperationExecutor.java:150)
at org.gradle.internal.operations.DefaultBuildOperationExecutor.call(DefaultBuildOperationExecutor.java:94)
at org.gradle.internal.operations.DelegatingBuildOperationExecutor.call(DelegatingBuildOperationExecutor.java:36)
at org.gradle.api.internal.tasks.execution.EventFiringTaskExecuter.execute(EventFiringTaskExecuter.java:52)
at org.gradle.execution.plan.LocalTaskNodeExecutor.execute(LocalTaskNodeExecutor.java:41)
at org.gradle.execution.taskgraph.DefaultTaskExecutionGraph$InvokeNodeExecutorsAction.execute(DefaultTaskExecutionGraph.java:356)
at org.gradle.execution.taskgraph.DefaultTaskExecutionGraph$InvokeNodeExecutorsAction.execute(DefaultTaskExecutionGraph.java:343)
at org.gradle.execution.taskgraph.DefaultTaskExecutionGraph$BuildOperationAwareExecutionAction.execute(DefaultTaskExecutionGraph.java:336)
at org.gradle.execution.taskgraph.DefaultTaskExecutionGraph$BuildOperationAwareExecutionAction.execute(DefaultTaskExecutionGraph.java:322)
at org.gradle.execution.plan.DefaultPlanExecutor$ExecutorWorker.lambda$run$0(DefaultPlanExecutor.java:127)
at org.gradle.execution.plan.DefaultPlanExecutor$ExecutorWorker.execute(DefaultPlanExecutor.java:191)
at org.gradle.execution.plan.DefaultPlanExecutor$ExecutorWorker.executeNextNode(DefaultPlanExecutor.java:182)
at org.gradle.execution.plan.DefaultPlanExecutor$ExecutorWorker.run(DefaultPlanExecutor.java:124)
at org.gradle.internal.concurrent.ExecutorPolicy$CatchAndRecordFailures.onExecute(ExecutorPolicy.java:64)
at org.gradle.internal.concurrent.ManagedExecutorImpl$1.run(ManagedExecutorImpl.java:48)
at org.gradle.internal.concurrent.ThreadFactoryImpl$ManagedThreadRunnable.run(ThreadFactoryImpl.java:56)
Caused by: org.gradle.api.internal.provider.AbstractProperty$PropertyQueryException: Failed to query the value of property 'packageName'.
at org.gradle.api.internal.provider.AbstractProperty.doCalculateValue(AbstractProperty.java:136)
at org.gradle.api.internal.provider.AbstractProperty.calculateOwnValue(AbstractProperty.java:127)
at org.gradle.api.internal.provider.AbstractMinimalProvider.calculateValue(AbstractMinimalProvider.java:103)
at org.gradle.api.internal.provider.AbstractMinimalProvider.withFinalValue(AbstractMinimalProvider.java:151)
at org.gradle.api.internal.provider.DefaultProperty.finalValue(DefaultProperty.java:133)
at org.gradle.api.internal.provider.DefaultProperty.finalValue(DefaultProperty.java:25)
at org.gradle.api.internal.provider.AbstractProperty.finalizeNow(AbstractProperty.java:236)
... 46 more
Caused by: com.android.builder.errors.EvalIssueException: Manifest file does not exist: /home/android-studio/Documents/SwiftAddress2/src/main/AndroidManifest.xml
at com.android.builder.errors.IssueReporter.reportError(IssueReporter.kt:106)
at com.android.builder.errors.IssueReporter.reportError$default(IssueReporter.kt:102)
at com.android.build.gradle.internal.manifest.LazyManifestParserKt.parseManifest(LazyManifestParser.kt:91)
at com.android.build.gradle.internal.manifest.LazyManifestParserKt.access$parseManifest(LazyManifestParser.kt:1)
at com.android.build.gradle.internal.manifest.LazyManifestParser$manifestData$2$provider$1.transform(LazyManifestParser.kt:47)
at com.android.build.gradle.internal.manifest.LazyManifestParser$manifestData$2$provider$1.transform(LazyManifestParser.kt:36)
at org.gradle.api.internal.provider.TransformBackedProvider.mapValue(TransformBackedProvider.java:73)
at org.gradle.api.internal.provider.TransformBackedProvider.calculateOwnValue(TransformBackedProvider.java:65)
at org.gradle.api.internal.provider.AbstractMinimalProvider.calculateValue(AbstractMinimalProvider.java:103)
at org.gradle.api.internal.provider.MappingProvider.calculateOwnValue(MappingProvider.java:55)
at org.gradle.api.internal.provider.AbstractMinimalProvider.calculateValue(AbstractMinimalProvider.java:103)
at org.gradle.api.internal.provider.AbstractMinimalProvider.withFinalValue(AbstractMinimalProvider.java:151)
at org.gradle.api.internal.provider.DefaultProperty.finalValue(DefaultProperty.java:133)
at org.gradle.api.internal.provider.DefaultProperty.finalValue(DefaultProperty.java:25)
at org.gradle.api.internal.provider.AbstractProperty.finalizeNow(AbstractProperty.java:236)
at org.gradle.api.internal.provider.AbstractProperty.beforeRead(AbstractProperty.java:230)
at org.gradle.api.internal.provider.AbstractProperty.calculateOwnValue(AbstractProperty.java:126)
at org.gradle.api.internal.provider.AbstractMinimalProvider.calculateValue(AbstractMinimalProvider.java:103)
at org.gradle.api.internal.provider.TransformBackedProvider.calculateOwnValue(TransformBackedProvider.java:64)
at org.gradle.api.internal.provider.AbstractMinimalProvider.calculateValue(AbstractMinimalProvider.java:103)
at org.gradle.api.internal.provider.MappingProvider.calculateOwnValue(MappingProvider.java:55)
at org.gradle.api.internal.provider.AbstractMinimalProvider.calculateValue(AbstractMinimalProvider.java:103)
at org.gradle.api.internal.provider.DefaultProperty.calculateValueFrom(DefaultProperty.java:128)
at org.gradle.api.internal.provider.DefaultProperty.calculateValueFrom(DefaultProperty.java:25)
at org.gradle.api.internal.provider.AbstractProperty.doCalculateValue(AbstractProperty.java:133)
... 52 more
在附加的第一段代码中(来自根配置的build.gradle)。有一个android配置。尝试删除它,我的意思是该文件应该只包含:
buildscript {
ext.kotlin_version = "1.4.20"
repositories {
google()
jcenter()
}
dependencies {
classpath "com.android.tools.build:gradle:4.1.1"
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
allprojects {
repositories {
google()
jcenter()
maven { url "https://jitpack.io"}
}
}
此外,尝试使用以下命令或仅使用android Studio中的clean选项来清理de项目:
./gradlew clean
最后,验证这个项目是否有另一个包名?或者您已经更改了该包名称?
有人能帮我纠正这个错误吗? 失败:生成失败,出现异常。 错误:任务执行失败:app:compiledBugJavaWithJavaC 无法查询任务': app: compileDebugJavaWitJavac'属性'options.generatedSourceOutputDirectory'的值。不支持查询map(java.io.文件属性(org.gradle.api.file.目录,固定(类
清单合并失败:来自AndroidManifest.xml:11:9-40的属性application@theme value=(@style/apptheme)也出现在[com.github.todd-davies:ProgressWheel:1.2]AndroidManifest.xml:13:9-56value=(@android:style/theme.notitlebar)中。建议:将't
所有这些都很好,但我正在尝试添加这个库https://github.com/wdullaer/MaterialDateTimePicker 突然,当我同步我的分级时,它给了我这个错误 即使我把这个建议加在我的清单上 我无法完成它,因为现在我得到了这个错误 编辑-解决方案:感谢所有的btw,所以降级库是可以的,但它给了我这个错误 关于不同版本支持的错误(由于我的级别,不能直接放,抱歉) 然后我做了一
当我使用构建Gradle时,我得到以下错误。请帮我解决这个问题。 错误消息:清单合并失败:[com.android.support:support-compat:28.0.0]AndroidManifest.xml:22:18-91中的属性application@AppComponentFactory value=(Android.support.v4.app.CoreComponentFacto
我试着建立我的应用程序,但它错误的像这样 清单合并失败:[com.android.support:support-compat:28.0.0]AndroidManifest.xml:22:18-91中的属性application@AppComponentFactory value=(Android.support.v4.app.CoreComponentFactory)也出现在[AndroidX.
我将遵循以下教程:https://www.youtube.com/watch?v=xtElLuzjA0U 我使用Android Studio 3.2.1-每当我实现实现'me.zhanghai.android.materialprogressbar:库:1.6.1'我得到这个错误: 当我第一次编写本教程时,所有内容都已编译,我能够获得进度条,但当我尝试调试和构建时,它崩溃了。现在,我的第二次,实现