Reputation: 943
I'm getting to know gradle and I work with Intellij Idea 13.1.3 with Android plugin. I want to build u2020 project and face some troubles with using gradle in Idea.
After importing the project all I get is single module 'u2020' with no dependencies set and meaningless project structure. Also Idea doesn't recognize the android framework of project, doesn't see .java files like classes.
There is single build.gradle file in the root. What should I do in order to run project in Idea? Add sourceSets to build.gradle?
UPD: build.gradle from github link:
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
}
}
Folders in the project
u2020
|
|_debug
| |_AndroidManifest.xml
| |_java
| |_res
| |_assets
|
|_main
| |_androidManifest.xml
| |_java
| |_all other android stuff
|
|_release
| |_java
|
|_build.gradle
|_other stuff
Upvotes: 1
Views: 688
Reputation: 979
Just import this project as gradle module in idea. And it's must work.
Upvotes: 0
Reputation: 4808
Most likely IJ's Gradle project import is not Android aware and imports correctly Java projects that have java
plugins applied. com.android.application
extends java-base
but not java
. The simplest solution can be to use Android Studio.
Upvotes: 2