【问题标题】:Why can't I debug my Android project over the phone?为什么我不能通过电话调试我的 Android 项目?
【发布时间】:2021-04-25 17:30:15
【问题描述】:

我刚刚进入 Android 开发领域,我需要第一次运行我的项目以继续我的学习过程。 不幸的是,我的电脑功能不够强大,无法运行 AVD,每次我尝试用手机调试它时,都会收到以下错误消息:

发现任务':app:processDebugManifest'的配置有问题
(输入“ProcessMultiApkApplicationManifest”)。
指定的文件“E:\android\app\build\intermediates\merged_manifest\debug\out\AndroidManifest.xml” 属性“mainMergedManifest”不存在。

一般信息:
我正在尝试使用我的 Galaxy A 70(运行 Android 10)调试一个全新的项目。如有必要,我很乐意(尽我所能)提供有关项目、我的手机或电脑规格等的任何其他信息。

应用模块的build.gradle:

    plugins {
    id 'com.android.application'
}

android {
    compileSdkVersion 29

    defaultConfig {
        applicationId "com.example.myapplication"
        minSdkVersion 18
        targetSdkVersion 29
        versionCode 1
        versionName "1.0"

        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
    }
}

dependencies {

    implementation 'androidx.appcompat:appcompat:1.2.0'
    implementation 'com.google.android.material:material:1.3.0'
    implementation 'androidx.constraintlayout:constraintlayout:2.0.4'
    testImplementation 'junit:junit:4.+'
    androidTestImplementation 'androidx.test.ext:junit:1.1.2'
    androidTestImplementation 'androidx.test.espresso:espresso-core:3.3.0'
}

AndroidManifest.xml:

<?xml version="1.0" encoding="utf-8"?>

<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.MyApplication">
    <activity android:name=".MainActivity">
        <intent-filter>
            <action android:name="android.intent.action.MAIN" />

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

我将非常感谢有关此问题的任何帮助。
提前感谢
佩里

【问题讨论】:

  • 你能分享你的app模块的build.gradle吗
  • 请创建一个debug buildTypes,并将debuggable 标志设为true

标签: android


【解决方案1】:

您需要一个设置为 debuggable true 的调试构建类型

将此添加到 build.gradel 中的 buildTypes

buildTypes {
    debug {
      debuggable true
    }
    release {
        minifyEnabled false
        proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
    }
}

然后运行 ​​gradle 同步。 ,在构建变体中选择debug配置,然后你就可以调试你的应用了

【讨论】:

  • 我现在感觉很愚蠢,因为这些步骤非常简单(PS 感谢添加图片,如果没有它们,我将无法找到这些按钮 :) 但不幸的是问题仍然存在。
  • 您是否收到不同的错误消息?还是同一个?
  • 你能发布你的 AndroidManifest.xml 文件吗?
  • 同一个
  • 另一件要尝试的事情是在构建应用程序之前运行 clean - 运行应用程序是否有效?
猜你喜欢
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2022-06-10
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2015-06-07
相关资源
最近更新 更多