Android的工作室0.3 +摇篮问题 [英] Android Studio 0.3.+ Gradle issues

查看:136
本文介绍了Android的工作室0.3 +摇篮问题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

自从我更新我的Andr​​oid Studio中的0.3.0化身,这是第一次我在它创建了一个项目(previously,我所做的就是维护已经存在的项目),以及多我的恐惧,有些事情似乎不对劲要么用或摇篮一般进口库。

Ever since I updated my Android Studio to its 0.3.0 incarnation, this is the very first time I've created a project in it (previously, all I did was maintenance of already existing projects) and, much to my horror, something seems amiss with either Gradle or importing libs in general.

首先,去了都与项目设置混乱周围的选项,我明白这是假想设计,所以我不碰坏,但如果摇篮未正确检测我的libs文件夹中的罐子?因为它的立场,无所谓什么我加在那里,它永远不会由Android工作室的认可。

First of all, gone are all the options to mess around with Project Settings, I understand this is supposedly by design, so I don't break something, but what if Gradle isn't properly detecting the jars in my libs folder? As it stands, doesn't matter what I add there, it's never recognized by Android Studio.

我遇到的另一个问题是导入模块,如Facebook的SDK的时候,我去到模块屏幕,并导入并将其添加到我的主模块的依赖关系。

Another issue I'm having is when importing modules, such as the Facebook SDK, I go over to the modules screen and import it and add it to my main module's dependencies.

这一切工作正常,并顺利在编译器中,以自动完成工作作为发条。但是,当它的时间来建立和运行应用程序,整个事情失败,我得到一个错误:摇篮:包com.facebook不存在

It all works fine and well in the compiler, with autocomplete working as a clockwork. However, when it's time to build and run the application, the whole thing fails and I get an Error: Gradle: package com.facebook does not exist.

如果我要做的就是导入库,甚至没有作出任何实际使用它这甚至发生(但同样,编译器看到绝对没有问题)。

And this even happens if all I do is import the library, not even making any actual use of it (but again, the compiler sees absolutely no issues).

任何人知道如何修复这些错误,什么可以做什么?导入这两个罐子和模块是最重要的我的应用程序,我根本就没有他们完成它。

Anyone knows how to fix these errors and what can be done? Importing both jars and modules are of utmost importance for my app and I simply cannot finish it without them.

推荐答案

有没有目前很多支持visial项目的编辑,因为它仍然是AndroidStudio早期的alpha版本。你必须修改的build.gradle 手动文件。建立正确的gradle这个最简单的方式建立的文件是他们工作的Eclipse项目出口。 ( http://developer.android.com/sdk/installing/migrate.html

There is not much support of visial project editing at the moment, since it is still early alpha version of AndroidStudio. You have to edit your build.gradle files manually. The easiest way of create correct gradle builds file is to export them from working eclipse project. (http://developer.android.com/sdk/installing/migrate.html)

Particullary使用FacebookSDK我将在你的应用程序中使用下一个段的build.gradle

Particullary for using FacebookSDK i would use next snippet at your application build.gradle:

apply plugin: 'android'

repositories {
    maven {
       url "http://mente.github.io/facebook-api-android-aar"
    }
}

dependencies {
   compile fileTree(dir: 'libs', include: '*.jar') // this includes all .jar libs
   compile 'com.facebook:facebook-android-sdk:3.5.2@aar' // this downloads facebookSDK 
}

请注意,你并不需要签Facebook的来源了!单行依赖使它容易得多,比以前。

Note, that you don't need to checkout facebook sources anymore! Single line dependencies make it so much easier than it was before.

请与您的的build.gradle 更新问题,如果你仍然有问题。最可能的问题奠定了那里。

Please, update question with your build.gradle if you still have issues. Most likely problem lays there.

这篇关于Android的工作室0.3 +摇篮问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆