为什么Android的工作室删除build.gradle上市的依赖? [英] Why does Android Studio delete dependencies listed in build.gradle?

查看:150
本文介绍了为什么Android的工作室删除build.gradle上市的依赖?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

此前Android的工作室开始随机地删除依赖从我build.gradle文件每当我创建一个新的文件。 是否有的期望一个特定的顺序? 我的依赖关系部分是这样的:

Earlier this week Android Studio started randomly deleting dependencies from my build.gradle file whenever I create a new file. Is there a particular order that's expected? My dependencies section looks like this:

dependencies {
    compile project(':ParallaxScroll')
    compile fileTree(dir: 'libs', include: ['*.jar'])
    compile 'com.google.android.gms:play-services:4.+'
    compile 'com.android.support:support-v4:19.+'
    compile 'com.android.support:support-v13:19.+'
    compile 'com.android.support:appcompat-v7:19.+'
    compile group: 'com.squareup.picasso', name: 'picasso', version: '2.2.0'
    compile group: 'com.squareup.retrofit', name: 'retrofit', version: '1.4.1'
    compile 'com.github.gabrielemariotti.cards:library:1.5.0'
    compile 'com.viewpagerindicator:library:2.4.1@aar'
    compile 'com.readystatesoftware.systembartint:systembartint:1.0.3'
    compile 'com.crashlytics.android:crashlytics:1.+'    
}

当我在项目中创建一个新的活动它结束了看起来像这种(发生这种情况,每次):

When I create a new activity in the project it ends up looking like this (this happens every time):

dependencies {
    compile project(':ParallaxScroll')
    compile fileTree(dir: 'libs', include: ['*.jar'])
    compile group: 'com.squareup.picasso', name: 'picasso', version: '2.2.0'
    compile group: 'com.squareup.retrofit', name: 'retrofit', version: '1.4.1'

    compile 'com.google.android.gms:play-services:4.+'
    compile 'com.android.support:support-v4:19.+'
    compile 'com.android.support:support-v13:19.+'
    compile 'com.android.support:appcompat-v7:19.+'
}

我花了一些时间来弄清楚发生了什么事。

It took a little while to figure out what was happening.

这两个编译格式,我使用是正确的?难道这可能导致问题?这不是一个问题,直到这个星期。

Which of the two compile formats I'm using is correct? Is this potentially causing issues? It wasn't an issue until this week.

我当然可以恢复我的依赖,但是这并不能解释为什么AS是所有的时间中删除的东西。

I can of course restore my dependencies but this doesn't explain why AS is deleting things all the time.

我也担心被列入这两个支持库。据我知道,我只用V4的东西。使用这两种做法不好?

I'm also concerned about both support libraries being included. As far as I know I'm using only v4 stuff. Is using both bad practice?

推荐答案

这是将被固定在0.5.9中的错误。你可以在这里追踪:

This is a bug that will be fixed in 0.5.9. You can track it here:

HTTPS://$c$c.google。 COM / P /安卓/问题/详细信息?ID = 60749

在此期间,作为一种解决方法,只要创建新的活动用手或保存关闭构建文件的内容通过向导创建它们之前。

In the meantime, as a workaround, just create new activities by hand, or save off the contents of the build file before creating them through the wizard.

这篇关于为什么Android的工作室删除build.gradle上市的依赖?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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