I have taken the following steps to migrate to Android Studio but right now I don't know what is wrong.
- In Eclipse I exported the gradle file. I did this because importing in Android Studio is not an option since it create a copy of the project and my project is under git.
- In Android Studio, I did "Open an existing Android Studio Project" and choose the gradle file.
- Since my original project used Maven for Maven dependencies, I add all of these to the gradle file.
Results: Most of the content in the build.gradle file is grayed out, telling me it cannot resolve symbol [name]. When I build, I have more than 100 errors, all of them related to dependencies not present (gradle not doing it's job). Also, I have been using gradle project in the last couple of days and the file is normally always asking to sync and it build the gradle file before building your project. In my case, nothing of that. It's like my project don't know he needs to use gradle or gradle is not configured the right way. Here is my gradle file and some screenshot to help you understand my problem. Any help is appreciated.
build.gradle:
buildscript {
repositories {
mavenCentral()
}
dependencies {
classpath 'com.android.tools.build:gradle:1.1.0'
}
}
apply plugin: 'com.android.application'
android {
compileSdkVersion 15
buildToolsVersion "19.1.0"
defaultConfig {
applicationId "XXXXXX"
minSdkVersion 15
targetSdkVersion 15
testApplicationId "XXXXXXX"
testInstrumentationRunner "android.test.InstrumentationTestRunner"
}
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_7
targetCompatibility JavaVersion.VERSION_1_7
}
buildTypes {
release {
minifyEnabled true
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-project.txt'
}
}
packagingOptions {
exclude 'META-INF/notice.txt'
exclude 'META-INF/NOTICE.txt'
exclude 'META-INF/license.txt'
exclude 'META-INF/LICENSE.txt'
exclude 'META-INF/ASL2.0'
exclude 'META-INF/LICENSE'
exclude 'META-INF/NOTICE'
}
sourceSets {
main {
manifest.srcFile 'AndroidManifest.xml'
java.srcDirs = ['src/main/java']
resources.srcDirs = ['src/main/java']
aidl.srcDirs = ['src/main/java']
renderscript.srcDirs = ['src/main/java']
res.srcDirs = ['res']
assets.srcDirs = ['assets']
}
}
}
dependencies {
compile group: 'com.google.android', name: 'android', version: '4.1.1.4' //provided
compile group: 'org.springframework.android', name: 'spring-android-core', version: '1.0.1.RELEASE'
compile group: 'commons-io', name: 'commons-io', version: '1.4'
compile group: 'org.springframework.android', name: 'spring-android-rest-template', version: '1.0.1.RELEASE'
compile group: 'org.codehaus.jackson', name: 'jackson-core-asl', version: '1.9.13'
compile group: 'org.codehaus.jackson', name: 'jackson-mapper-asl', version: '1.9.13'
compile group: 'com.google.code.gson', name: 'gson', version: '2.3'
compile group: 'org.java-websocket', name: 'Java-WebSocket', version: '1.3.0'
compile group: 'joda-time', name: 'joda-time', version: '2.3'
compile group: 'net.erdfelt.android', name: 'apk-parser', version: '1.0.2'
compile group: 'org.apache.commons', name: 'commons-compress', version: '1.9'
testCompile group: 'junit', name: 'junit', version: '4.12'
testCompile group: 'org.mockito', name: 'mockito-core', version: '1.10.8'
testCompile group: 'org.powermock', name: 'powermock-module-junit4', version: '1.6.1'
testCompile group: 'org.powermock', name: 'powermock-api-mockito', version: '1.6.1'
}
Screenshot of what it looks like in android studio:
No gradle subfolder in Android View? Is it normal?!
Thank you!
EDIT I did like suggested in the comment. I seem to be a step further but I'm having the message: "Gradle project sync failed. Basic functionality will not work properly". In the message below, I have this. What can I do?
Error:Unable to load class 'org.codehaus.groovy.runtime.typehandling.ShortTypeHandling'.
Possible causes for this unexpected error include:<ul><li>You are using JDK version 'java version "1.7.0_75"'. Some versions of JDK 1.7 (e.g. 1.7.0_10) may cause class loading errors in Gradle.
Please update to a newer version (e.g. 1.7.0_67).
<a href="open.project.structure">Open JDK Settings</a></li><li>Gradle's dependency cache may be corrupt (this sometimes occurs after a network connection timeout.)
<a href="syncProject">Re-download dependencies and sync project (requires network)</a></li><li>The state of a Gradle build process (daemon) may be corrupt. Stopping all Gradle daemons may solve this problem.
<a href="stopGradleDaemons">Stop Gradle build processes (requires restart)</a></li></ul>In the case of corrupt Gradle processes, you can also try closing the IDE and then killing all Java processes.