Reputation: 721
I am trying to move my project from Eclipse to Android studio. I have tries 2 methods:
Importing the current project using the Import in the Android Studio IDE.
Exporting the current project as a Grade project
(although I do not have grade set in my eclipse project) and then importing it to the Android Studio.
With the first method I got gradle and API errors such us:
No versions available for com.android.support:support-v4:jar (I installed the 22 and 23 sdk, none of them fixed the issue).
Error:(15, 0) Gradle DSL method not found: 'android()' Possible causes: The project may be using a version of Gradle that does not contain the method. Gradle settings.The build file may be missing a Gradle plugin. Apply Gradle plugin
with the second method in the project explorer I see only the Java src file without the res folders.
Here is the Gradle code:
buildscript {
repositories {
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:0.12.+'
}
}
apply plugin: 'com.android.application'
dependencies {
compile fileTree(include: '*.jar', dir: 'libs')
}
android {
compileSdkVersion 23
buildToolsVersion '23.0.0'
sourceSets {
main {
manifest.srcFile 'AndroidManifest.xml'
java.srcDirs = ['src']
resources.srcDirs = ['src']
aidl.srcDirs = ['src']
renderscript.srcDirs = ['src']
res.srcDirs = ['res']
assets.srcDirs = ['assets']
}
// Move the tests to tests/java, tests/res, etc...
instrumentTest.setRoot('tests')
// Move the build types to build-types/<type>
// For instance, build-types/debug/java, build-types/debug/AndroidManifest.xml, ...
// This moves them out of them default location under src/<type>/... which would
// conflict with src/ being used by the main source set.
// Adding new build types or product flavors should be accompanied
// by a similar customization.
debug.setRoot('build-types/debug')
release.setRoot('build-types/release')
}
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_7
targetCompatibility JavaVersion.VERSION_1_7
}
}
What is the correct way to go? I am doing this basically in order to add the Gradle to my project.
Thank you!
Upvotes: 0
Views: 136
Reputation: 338
You go with first way and change the android support version.
step: You go to Open Module Setting then remove the old dependency. And Select the below support file then sync the project.
Version 23: support-v4 (com.android.support:support-v4:23.0.1)
Upvotes: 2