Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Gradle indentation issue in Android Studio 2.3

Every time I create a new Activity in AS 2.3 it messes up the build.gradle indentation that results in errors like this.

Error:Could not get unknown property 'compile' for object of type org.gradle.api.internal.artifacts.dsl.dependencies.DefaultDependencyHandler.

I have to redo the indentations every time. Any idea how to fix this permanently?

like image 277
wick.ed Avatar asked Mar 23 '17 19:03

wick.ed


People also ask

What is Gradle Project Sync failed in Android Studio?

For this, you have to connect your PC to the internet and you have to open your Android studio. After opening your project click on the Sync Project with Gradle files option. This will automatically download the new Gradle files and will fix the issue which is caused by the Gradle files.

How do I sync Gradle with Android Studio?

Open your gradle. properties file in Android Studio. Restart Android Studio for your changes to take effect. Click Sync Project with Gradle Files to sync your project.

What is new in Android Studio Bumblebee?

Some notable additions include a unified test execution between Android Studio and your continuous integration (CI) server ✅, convenient pairing flows to support ADB over Wi-Fi 📲, Improved Profiler tools to help you identify and analyze jank in your app 🕵️, and new ways to preview animations 🎥 and UI interactions ...

What is Gradle Android Studio?

Android Studio uses Gradle, an advanced build toolkit, to automate and manage the build process, while allowing you to define flexible custom build configurations. Each build configuration can define its own set of code and resources, while reusing the parts common to all versions of your app.


1 Answers

Don't use compile as a property and don't change the gradle structure.

compile 'com.android.support:appcompat-v7:22.2.1' compile

 'com.parse:parse-android:1.11.0'

Sometimes Gradle build messes up the code like above, it still happens. Probably related to Java JDK updates.

like image 104
Ege Kuzubasioglu Avatar answered Oct 17 '22 02:10

Ege Kuzubasioglu