应用程序无法调试android

时间:2016-05-20 12:45:41

标签: android xml debugging android-studio adb

Android Studio无法开始调试我的应用。它会输出消息ScreenShot

我的AndroidManifest.xml文件

<manifest xmlns:android="http://schemas.android.com/apk/res/android"
  xmlns:tools="http://schemas.android.com/tools"
  package="com.xxx" >

<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />

<application
    android:debuggable="true"
    android:allowBackup="true"
    android:icon="@mipmap/ic_launcher"
    android:label="@string/app_name"
    android:supportsRtl="true"
    android:theme="@style/AppTheme"
    tools:ignore="HardcodedDebugMode">
    <activity android:name="com.xxx.MainContentActivity" >
        <intent-filter>
            <action android:name="android.intent.action.MAIN" />

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

    <meta-data
        android:name="com.google.android.gms.version"
        android:value="@integer/google_play_services_version" />
</application>

我的Gradle

apply plugin: 'com.android.application'

android {
    compileSdkVersion 23
    buildToolsVersion "23.0.3"
    defaultConfig {
        applicationId "com.xxx"
        minSdkVersion 14
        targetSdkVersion 23
        versionCode 2
        versionName "1.0"
    }
    buildTypes {
        release {
            minifyEnabled true
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
    }
}

dependencies {
    compile fileTree(include: ['*.jar'], dir: 'libs')
    testCompile 'junit:junit:4.12'
    compile 'com.android.support:appcompat-v7:23.3.0'
    compile 'com.android.support:design:23.3.0'
    compile 'com.android.support:recyclerview-v7:23.3.0'
    compile 'com.android.support:cardview-v7:23.3.0'
    compile 'com.google.android.gms:play-services:8.4.0'
}

我尝试清理/重建gradle项目,重启Android Studio,无效缓存和重新安装ADB集成(工具 - &gt; Android - &gt;禁用ADB集成 - &gt;启用ADB集成)

有什么想法吗?

P.S。在此之前,我更改了应用程序包的名称

P.S。{2} Android Studio无法调试其他项目。

2 个答案:

答案 0 :(得分:1)

执行以下步骤:

导航到工具 - &gt; android - &gt;禁用adb集成并再次启用它

在设备上拔下USB后再插上电源。

再次调试。

结帐this link

希望这会有所帮助。

答案 1 :(得分:0)

两天后,我找到了摆脱我情况的唯一出路.Android Studio只调试新项目。因此,必须使用修改的包名称(存储代码)删除旧项目,使用所需的包名称创建新项目并还原代码。谢谢大家的回答和帮助。