Android studio crashed my build.gradle file after adding fragment

Using Android Studio 2.0 over El Capitan, like the following screenshot:
Android Studio 2.0 on El Capitan

I found an error that I can not report: After adding a fragment to my AS project, my build.gradle file will be deleted. I mean, before adding the fragment, they look like this screenshot:
build.gradle screenshot

but after adding Fragment AS, twist it like this:
build.gradle dependency screenshot 2

A way to reproduce this, as shown in the following screenshot:
enter image description here

I can fix it manually, but it is so annoying doing it every time I add a fragment. Is there any way to fix this?

I am on a Mac OX with El Capitan.

+20
android android-studio android-gradle build.gradle osx-elcapitan
Apr 25 '16 at 15:14
source share
4 answers

This is still an open error, you can control its status here.

The error is related to the comments in the dependency section, a temporary fix may be to remove them from there. I also posted comments for this reason :)

+17
Oct 13 '16 at 21:33
source share

Delete all comments in gradle file

+4
Dec 28 '16 at 21:47
source share

put your mock limiter below, it won’t scramble again (I don’t know why, but it works)

dependencies { compile fileTree(dir: 'libs', include: ['*.jar']) // support lib compile "com.android.support:appcompat-v7:$supportlib_version" // kotlin compile "org.jetbrains.kotlin:kotlin-stdlib-jre7:$kotlin_version" // ... compile 'com.android.support.constraint:constraint-layout:1.0.2' testCompile 'junit:junit:4.12' } 
0
Aug 26 '17 at 5:21 on
source share

just reformat your gradle project level. It will work fine. This compilation statement has been formatted. Just press Enter before each "compilation" it should look like this:

 compile 'com.android.support:support-v13:23.4.0' compile 'com.android.support:appcompat-v7:23.4.0' compile 'com.android.support:recyclerview-v7:23.4.0' compile 'com.android.support:cardview-v7:23.4.0' compile 'com.android.support:design:23.4.0' 

img

-one
Sep 26 '16 at 13:52
source share



All Articles