2015-01-13 3 views
1

나는 gradle을 알게되어 Android 플러그인으로 Intellij Idea 13.1.3에서 작업합니다. 저는 u2020 프로젝트를 만들고 아이디어에 gradle을 사용하여 몇 가지 문제에 직면하고 싶습니다.아이디어에서 gradle android 프로젝트를 가져올 수 없습니다.

프로젝트 가져 오기가 끝나면 종속성이없고 의미있는 프로젝트 구조가없는 단일 모듈 'u2020'만 있습니다. 또한 Idea는 프로젝트의 안드로이드 프레임 워크를 인식하지 못하고 클래스와 같은 .java 파일을 보지 못합니다.

루트에 단일 build.gradle 파일이 있습니다. 아이디어에서 프로젝트를 실행하려면 어떻게해야합니까? build.gradle에 sourceSets를 추가 하시겠습니까?

UPD : GitHub의 링크에서 build.gradle : 프로젝트

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

}  

// Manifest version information! 
def versionMajor = 1 
def versionMinor = 0 
def versionPatch = 0 
def versionBuild = 0 // bump for dogfood builds, public betas, etc. 

apply plugin: 'com.android.application' 

repositories { 
    mavenCentral() 
} 

dependencies { 
    compile 'com.android.support:support-v4:21.0.3' 

    compile 'com.squareup.dagger:dagger:1.2.2' 
    provided 'com.squareup.dagger:dagger-compiler:1.2.2' 

    compile 'com.squareup.okhttp:okhttp:2.1.0' 
    compile 'com.squareup.okhttp:okhttp-urlconnection:2.1.0' 
    compile 'com.squareup.picasso:picasso:2.4.0' 
    compile 'com.squareup.retrofit:retrofit:1.8.0' 
    debugCompile 'com.squareup.retrofit:retrofit-mock:1.8.0' 

    compile 'com.jakewharton:butterknife:6.0.0' 
    compile 'com.jakewharton.timber:timber:2.5.0' 
    debugCompile 'com.jakewharton.madge:madge:1.1.1' 
    debugCompile 'com.jakewharton.scalpel:scalpel:1.1.1' 

    compile 'io.reactivex:rxjava:1.0.3' 
    compile 'io.reactivex:rxandroid:0.23.0' 

    compile 'com.etsy.android.grid:library:1.0.3' 
} 

def gitSha = 'git rev-parse --short HEAD'.execute([], project.rootDir).text.trim() 
def buildTime = new Date().format("yyyy-MM-dd'T'HH:mm'Z'", TimeZone.getTimeZone("UTC")) 

def isTravis = "true".equals(System.getenv("TRAVIS")) 
def preDexEnabled = "true".equals(System.getProperty("pre-dex", "true")) 

android { 
    compileSdkVersion 21 
    buildToolsVersion '21.1.1' 

    dexOptions { 
    // Skip pre-dexing when running on Travis CI or when disabled via -Dpre-dex=false. 
    preDexLibraries = preDexEnabled && !isTravis 
    } 

    defaultConfig { 
    minSdkVersion 15 
    targetSdkVersion 21 

    versionCode versionMajor * 10000 + versionMinor * 1000 + versionPatch * 100 + versionBuild 
    versionName "${versionMajor}.${versionMinor}.${versionPatch}" 

    buildConfigField "String", "GIT_SHA", "\"${gitSha}\"" 
    buildConfigField "String", "BUILD_TIME", "\"${buildTime}\"" 
    } 

    buildTypes { 
    debug { 
     applicationIdSuffix '.dev' 
     versionNameSuffix '-dev' 
    } 
    } 

    lintOptions { 
    abortOnError false 
    } 

    compileOptions { 
    sourceCompatibility JavaVersion.VERSION_1_7 
    targetCompatibility JavaVersion.VERSION_1_7 
    } 
} 

폴더

u2020  
|  
|_debug  
| |_AndroidManifest.xml 
| |_java 
| |_res 
| |_assets 
| 
|_main 
| |_androidManifest.xml 
| |_java 
| |_all other android stuff 
| 
|_release 
| |_java 
| 
|_build.gradle 
|_other stuff 
+0

더 많은 정보가 필요합니다. 프로젝트 구조, build.gradle 파일 등 – shkschneider

답변

2
java이 제대로 자바 프로젝트

대부분의 IJ의 Gradle을 프로젝트 가져 오기가 인식 안드로이드되지 않은 가능성 및 수입 플러그인 적용. com.android.applicationjava-base인데 java이 아닙니다. 가장 간단한 해결책은 Android Studio를 사용하는 것입니다.

+0

Android Studio가 프로젝트를 잘 처리했습니다. 이 문제에 대한 설명 주셔서 감사합니다! –

0

이 프로젝트를 아이디어의 gradle 모듈로 가져옵니다. 그리고 그것은 효과가 있어야합니다.

enter image description here

관련 문제