【问题标题】:manifest.srcFile causing contentRoot to be unset on IntelliJ importmanifest.srcFile 导致在 IntelliJ 导入时取消设置 contentRoot
【发布时间】:2015-01-18 05:00:24
【问题描述】:

当我从 build.gradle 文件导入 IntelliJ 14.0.2 时,如果我在 sourceSet 中指定 manifest.srcFile 则不会生成 .iml 并且永远不会设置 contentRoot - 基本上没有项目,它是只是一个文件列表。

有人遇到过这个问题吗?

// Top-level build file where you can add configuration options common to all sub-projects/modules.

buildscript {
    repositories {
        mavenCentral()
    }
    dependencies {
        classpath 'com.android.tools.build:gradle:1.0.0'

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

repositories {
    mavenCentral()
}

apply plugin: 'android'

android {
    compileSdkVersion 21
    buildToolsVersion "21.1.2"

    defaultConfig {
        minSdkVersion 14
        targetSdkVersion 19
        versionCode 1
        versionName "0.01"
    }
    sourceSets {
        main {
            manifest.srcFile 'AndroidManifest.xml'
        }
    }
    buildTypes {
        release {
            minifyEnabled true
            proguardFiles getDefaultProguardFile('proguard-android.txt')
        }
        debug {
            debuggable true
        }
    }
}

dependencies {
    // all *.jar files in the libs dir
    compile fileTree(dir: 'libs', include: ['*.jar'])

    // remote dependencies
    compile 'com.android.support:appcompat-v7:21.0.3'
}

【问题讨论】:

    标签: java android intellij-idea gradle android-gradle-plugin


    【解决方案1】:

    您应用的插件不正确,因此没有设置 Android 特定项目。应该是:

    apply plugin: 'com.android.application'
    

    【讨论】:

      猜你喜欢
      • 2015-03-28
      • 1970-01-01
      • 1970-01-01
      • 2017-04-30
      • 2013-12-30
      • 1970-01-01
      • 2014-01-10
      • 2017-04-08
      • 1970-01-01
      相关资源
      最近更新 更多