Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

@sagar-viradiya
Last active January 3, 2024 22:47
Show Gist options
  • Star 9 You must be signed in to star a gist
  • Fork 13 You must be signed in to fork a gist
  • Save sagar-viradiya/ea05cdeb8471ca028dd361e53512189e to your computer and use it in GitHub Desktop.
Save sagar-viradiya/ea05cdeb8471ca028dd361e53512189e to your computer and use it in GitHub Desktop.
DevFest India 2020 Day 1 - build.gradle file
apply plugin: 'com.android.application'
apply plugin: 'kotlin-android'
apply plugin: 'kotlin-android-extensions'
apply plugin: "kotlin-kapt"
android {
compileSdkVersion 29
defaultConfig {
applicationId "com.devfest.india.bmsclone"
minSdkVersion 21
targetSdkVersion 29
versionCode 1
versionName "1.0"
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
}
}
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
kotlinOptions {
jvmTarget = "1.8"
}
}
dependencies {
implementation fileTree(dir: "libs", include: ["*.jar"])
implementation "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version"
implementation 'androidx.core:core-ktx:1.3.1'
implementation 'androidx.appcompat:appcompat:1.2.0'
implementation 'com.google.android.material:material:1.2.1'
implementation 'androidx.constraintlayout:constraintlayout:2.0.1'
testImplementation 'junit:junit:4.13'
androidTestImplementation 'androidx.test.ext:junit:1.1.2'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.3.0'
//Retrofit for Networking
implementation 'com.squareup.retrofit2:retrofit:2.9.0'
implementation 'com.squareup.retrofit2:converter-gson:2.9.0'
//Glide Image Loading Library
implementation 'com.github.bumptech.glide:glide:4.11.0'
//Room DB for database
implementation "androidx.room:room-runtime:2.2.5"
kapt "androidx.room:room-compiler:2.2.5"
kapt "androidx.lifecycle:lifecycle-compiler:2.2.0"
// ViewModel
implementation "androidx.lifecycle:lifecycle-extensions:2.2.0"
implementation "androidx.lifecycle:lifecycle-viewmodel-ktx:2.2.0"
}
@GauravChoudhary8411
Copy link

Giving error at line 55: kapt "androidx.room:room-compiler:2.2.5"

@GauravChoudhary8411
Copy link

Giving error at line 55: kapt "androidx.room:room-compiler:2.2.5"

I forgot to add :
apply plugin: 'kotlin-android-extensions'
apply plugin: "kotlin-kapt"

Now it's working fine

@sharath2106
Copy link

Where should I add this build.gradle?

Screenshot 2020-10-16 at 4 18 40 PM

Excuse my ignorance, I'm completely new to this.

@nidhinprathap
Copy link

@sharath2106 add it within the app folder

@KunalFarmah98
Copy link

KunalFarmah98 commented Oct 16, 2020

For those getting Errors
please add
apply plugin: 'kotlin-kapt'
outside of dependencies else kapt wil not be recognized by gradle

Also add the dependencies for recyclerView and Material Components
implementation 'androidx.recyclerview:recyclerview:1.1.0'
implementation 'com.google.android.material:material:1.2.1'

@withaarzoo
Copy link

Thanks

@anubhavbagri
Copy link

anubhavbagri commented Oct 16, 2020

A problem occurred evaluating root project 'BookMyShow Clone'.

Could not initialize class org.jetbrains.kotlin.gradle.internal.KotlinSourceSetProviderImplKt

There's this error i'm getting

@ansulagrawal
Copy link

In dependencies
change

implementation "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version"
implementation 'com.google.android.material:material:1.2.1
to
implementation "org.jetbrains.kotlin:kotlin-stdlib:1.4.10"
implementation("com.google.android.material:material:1.3.0-alpha03")

@sagar-viradiya
Copy link
Author

Thanks for answering @ansulagrawal . @anubhavbagri Let me know if you are still struggling with issue.

@sagar-viradiya
Copy link
Author

@sanchitsharma1 Make sure you have installed the SDK platform for android version 29. Go to SDK Manager (You can find it in the toolbar on top) -> SDK platform tab and choose Android 10.0 -> click on Apply below. After installation this should have been fix.

@sanchitsharma1
Copy link

sanchitsharma1 commented Oct 16, 2020 via email

@vikhyat187
Copy link

Can I get a java version of this file since I know java only.

@sagar-viradiya
Copy link
Author

@vikhyat187 this file uses groovy language. Gradle build system is based on groovy language.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment