水之积也不厚,则其负大舟也无力 2018-04-25 15:13 采纳率: 100%
浏览 8520
已采纳

安卓开发:org.gradle.tooling.BuildException:

在真机上出现这个异常
org.gradle.tooling.BuildException: Exception while generating InstantRun main resources APK

在真机上运行出现这个异常

我的清单文件
<?xml version="1.0" encoding="utf-8"?>
xmlns:tools="http://schemas.android.com/tools"
package="com.example.lenovo.mynotebook">

<provider
    android:name="android.support.v4.content.FileProvider"
    android:authorities="com.example.lenovo.mynotebook.fileprovider"
    android:exported="false"
    android:grantUriPermissions="true">
    <meta-data
        android:name="android.support.FILE_PROVIDER_PATHS"
        android:resource="@xml/provider_paths" />
</provider>


<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"/>
<uses-permission android:name="android.permission.MOUNT_UNMOUNT_FILESYSTEMS"
    tools:ignore="ProtectedPermissions" />
<uses-permission android:name="android.permission.CAMERA" />
<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/AppTheme">
    <activity android:name=".MainActivity"
        android:windowSoftInputMode="adjustUnspecified|stateHidden"
        >

        <intent-filter>
            <action android:name="android.intent.action.MAIN" />

            <category android:name="android.intent.category.LAUNCHER" />
        </intent-filter>
    </activity>
    <activity android:name=".edit_activity"
        android:windowSoftInputMode="adjustUnspecified|stateHidden"
        >

    </activity>
</application>

 我的build.gradle(Project)
 // Top-level build file where you can add configuration options common to all sub-projects/modules.

buildscript {

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


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

allprojects {
    repositories {
        google()
        jcenter()
    }
}

task clean(type: Delete) {
    delete rootProject.buildDir
}


 我的build.gradle(app) 
```apply plugin: 'com.android.application'

android {
    compileSdkVersion 27
    defaultConfig {
        applicationId "com.example.lenovo.mynotebook"
        minSdkVersion 15
        targetSdkVersion 27
        versionCode 1
        versionName "1.0"
        testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
    }
    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
    }
}

dependencies {
    implementation fileTree(include: ['*.jar'], dir: 'libs')
    implementation 'com.android.support.constraint:constraint-layout:1.0.2'
    testImplementation 'junit:junit:4.12'
    androidTestImplementation 'com.android.support.test:runner:1.0.1'
    androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.1'
    implementation 'com.android.support:support-v4:27.1.1'
}



  • 写回答

1条回答

      报告相同问题?

      相关推荐 更多相似问题

      悬赏问题

      • ¥15 我一点思路没有 《用51单片机实现》 通俗易懂,如何解决?(语言-c语言)
      • ¥15 Halcon 曲线拟合时怎么过滤掉异常点
      • ¥15 edge浏览器最近莫名其妙老是每隔一段时间弹出色情网站,求解决。。
      • ¥15 “glmnet”运行出错
      • ¥30 如何用matlab表达以下公式?
      • ¥15 在arm架构芯片上基于32位linux操作系统做内存检查
      • ¥15 怎么样才能禁止VS自动调整Windows窗体布局
      • ¥15 mysql5.7.40安装到Initializing database报错,如何解决?
      • ¥30 如何降低hdfs中datanode的JVM内存用量
      • ¥15 Android URL如何转成视频/音频,可行吗?