简体   繁体   English

如何在Studio Android中导入Eclipse项目,库和依赖项

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

I am very new on using android studio. 我对使用android studio感到很陌生。 I am having one eclipse project having Facebook SDK, Google play service, and some other libs as dependencies of my project. 我有一个日食项目,具有Facebook SDK,Google play服务和其他一些libs作为我项目的依赖项。 I want to ask how to import that project in studio? 我想问一下如何在Studio中导入该项目? I have made gradle file of my project but when i import gradle file in studio Facebook and GCM service error occurs. 我已经为我的项目制作了gradle文件,但是当我在Studio Facebook中导入gradle文件时,发生了GCM服务错误。 Please can some body tell me the steps so i can import and run project in studio? 请有人告诉我步骤,以便我可以在Studio中导入和运行项目吗?

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. 从Eclipse迁移到Android Studio要求您更改开发项目的结构,移至新的构建系统,并使用新的用户界面。 Here are some of the key changes you should be aware of as you prepare to migrate to Android Studio: 以下是准备迁移到Android Studio时应注意的一些关键更改:

  1. Project files 项目文件
  2. Manifest settings 清单设置
  3. Dependencies 依存关系
  4. Test code 测试码
  5. User interface 用户界面
  6. Gradle-based build 基于Gradle的构建
  7. systemDeveloper 系统开发人员
  8. tools versioning 工具版本控制

At first please read this article Migrating to Android Studio And Demo 首先,请阅读此文章迁移到Android Studio演示

Now for your requirement add this in your 现在根据您的要求在您的

build.gradle 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.+"
}

I would suggest creating a new blank Android Studio project to set up the directory structure and boilerplate. 我建议创建一个新的空白Android Studio项目以设置目录结构和样板。 Most of your traditional Eclipse files would go in the app/ directory. 您的大多数传统Eclipse文件将放在app/目录中。 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, eg add: 然后,您需要使用外部依赖项更新app/build.gradle文件,并告诉gradle拾取app/lib/目录中的所有其他jar,例如,添加:

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 . 您可能还需要对GCM https://developers.google.com/cloud-messaging/android/client的gradle文件进行更多更改。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM