How to import eclipse project ,libs and dependancy in studio android

邮差的信 提交于 2019-12-12 01:47:31

问题


I am very new on using android studio. I am having one eclipse project having Facebook SDK, Google play service, and some other libs as dependencies of my project. I want to ask how to import that project in studio? I have made gradle file of my project but when i import gradle file in studio Facebook and GCM service error occurs. Please can some body tell me the steps so i can import and run project in studio?


回答1:


Migrating from Eclipse to Android Studio requires that you change the structure of your development projects, move to a new build system, and use a new user interface. Here are some of the key changes you should be aware of as you prepare to migrate to Android Studio:

  1. Project files
  2. Manifest settings
  3. Dependencies
  4. Test code
  5. User interface
  6. Gradle-based build
  7. systemDeveloper
  8. tools versioning

At first please read this article Migrating to Android Studio And Demo

Now for your requirement add this in your

build.gradle

  dependencies {
  compile fileTree(dir: 'libs', include: ['*.jar'])
  compile 'com.facebook.android:facebook-android-sdk:4.1.0'
  compile "com.google.android.gms:play-services:7.5.+"
}



回答2:


I would suggest creating a new blank Android Studio project to set up the directory structure and boilerplate. Most of your traditional Eclipse files would go in the app/ directory. Then You'll need to update your app/build.gradle file with your external dependencies as well as tell gradle to pick up any other jars in your app/lib/ directory, e.g. add:

dependencies {
  compile fileTree(dir: 'libs', include: ['*.jar'])
  compile 'com.facebook.android:facebook-android-sdk:4.1.0'
  compile "com.google.android.gms:play-services:7.5.+"
}

You also might need to make a couple more changes to the gradle file for GCM https://developers.google.com/cloud-messaging/android/client.



来源:https://stackoverflow.com/questions/31823713/how-to-import-eclipse-project-libs-and-dependancy-in-studio-android

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!