implementing the com.amulyakhare library in android studio - android-studio

Hello i am trying to import a library called amulyakhare from github into my android studio project but i keep getting the following error after syncing:
Failed to resolve: com.amulyakhare:com.amulyakhare.textdrawable:1.0.1
Show in Project Structure dialog
Affected Modules: app
You can find the github page of the library here :
#github/amulyakhare
This is the code in the build.gradle(app):
apply plugin: 'com.android.application'
apply plugin: 'com.google.gms.google-services'
android {
compileSdkVersion 30
defaultConfig {
applicationId "com.example.androidnewchatapp"
minSdkVersion 28
targetSdkVersion 30
versionCode 1
versionName "1.0"
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
implementation platform('com.google.firebase:firebase-bom:27.1.0')
implementation 'androidx.appcompat:appcompat:1.2.0'
implementation 'com.google.android.material:material:1.3.0'
implementation 'androidx.constraintlayout:constraintlayout:2.0.4'
//Firebase UI
implementation 'com.firebaseui:firebase-ui-auth:7.1.1'
implementation 'com.firebaseui:firebase-ui-database:7.1.1'
//viewPager 2
implementation 'androidx.viewpager2:viewpager2:1.1.0-alpha01'
//ButterKnife
implementation 'com.jakewharton:butterknife:10.2.3'
annotationProcessor'com.jakewharton:butterknife-compiler:10.2.3'
//Dexter
implementation 'com.karumi:dexter:6.1.2'
//TextDrawable (The amulyakhare Library)
implementation 'com.amulyakhare:com.amulyakhare.textdrawable:1.0.1'
//EventBus
implementation 'org.greenrobot:eventbus:3.2.0'
//Glide
implementation 'com.github.bumptech.glide:glide:4.12.0'
annotationProcessor'com.github.bumptech.glide:compiler:4.11.0'
testImplementation 'junit:junit:4.13.2'
androidTestImplementation 'androidx.test.ext:junit:1.1.2'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.3.0'
implementation 'com.google.firebase:firebase-analytics'
}
i dont know if there is something wrong wih the library or there is something missing in my code. Thank you in adnvance to those who can help out

Add this to your settings.gradle
jcenter()
maven {
url 'https://jitpack.io'
}
if you're using android studio bumblebee settings.gradle should be like this
pluginManagement {
repositories {
gradlePluginPortal()
google()
mavenCentral()
}
}
dependencyResolutionManagement {
repositoriesMode.set(RepositoriesMode.FAIL_ON_PROJECT_REPOS)
repositories {
google()
mavenCentral()
jcenter()
maven {
url 'https://jitpack.io'
}
}
}
rootProject.name = "You App Name"
include ':app'
If not work, try to import jar file, download from this

I figured it out
1)In your project level gradle add jcenter()
allprojects {
repositories {
google()
jcenter()
maven { url 'https://jitpack.io' }
}
}

JCenter Maven repository is no longer receiving updates: newer library versions may be available elsewhere
so You need to find same library somewhere else. or you can fork yourself and upload to jitpack
OR
Add it in your root build.gradle at the end of repositories:
allprojects {
repositories {
...
maven { url 'https://jitpack.io' }
}
}
Add the dependency
dependencies {
implementation 'com.github.alvinhkh:TextDrawable:f9f516c43b'
}
https://jitpack.io/#alvinhkh/TextDrawable/f9f516c43b

ADD these Simple Lines In Build.Gradle
buildscript {
repositories {
google()
mavenCentral()
maven {
url "https://plugins.gradle.org/m2/"
}
maven { url "https://www.jitpack.io" }
jcenter()
maven {
url 'http://dl.bintray.com/amulyakhare/maven'
}
}
dependencies {
//Your dependencies here
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
allprojects {
repositories {
google()
jcenter()
maven { url 'https://maven.google.com' }
maven { url "https://www.jitpack.io" }
maven { url 'https://jitpack.io' }
mavenCentral()
}
}
And in Build.Gradle (App)
implementation 'com.amulyakhare:com.amulyakhare.textdrawable:1.0.1'
Will work 100%

Related

Issue when implementing dependecies

I want to utilise this widgetfrom https://github.com/eschao/android-ElasticListView
I have already followed the instructions from the Github as per the code below but it still throws me an error.
I need to use this dependency for my application to allow it to 'refresh' when I pull it up, similar to an Instagram feed page. If this does not work, are there any other widgets that I can check out?
Under project gradle:
// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
repositories {
// Check that you have the following line (if not, add it):
google() // Google's Maven repository
}
dependencies {
// Add this line
classpath 'com.google.gms:google-services:4.3.10'
}
}
plugins {
id 'com.android.application' version '7.1.2' apply false
id 'com.android.library' version '7.1.2' apply false
}
allprojects {
repositories {
// Check that you have the following line (if not, add it):
google() // Google's Maven repository
maven { url "https://jitpack.io" }
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}
Under app gradle:
plugins {
id 'com.android.application'
id 'com.google.gms.google-services'
}
android {
compileSdk 32
defaultConfig {
applicationId "com.example.shibushi"
minSdk 21
targetSdk 32
versionCode 1
versionName "1.0"
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
}
![enter image description here](https://i.stack.imgur.com/bDRkZ.png)
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
}
}
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
}
dependencies {
implementation 'androidx.appcompat:appcompat:1.4.1'
implementation 'com.google.android.material:material:1.5.0'
implementation 'androidx.constraintlayout:constraintlayout:2.1.3'
implementation 'com.google.firebase:firebase-auth:21.0.2'
implementation 'com.google.firebase:firebase-storage:20.0.1'
implementation 'com.google.firebase:firebase-database:20.0.4'
implementation 'androidx.recyclerview:recyclerview:1.2.1'
implementation 'androidx.cardview:cardview:1.0.0'
testImplementation 'junit:junit:4.13.2'
androidTestImplementation 'androidx.test.ext:junit:1.1.3'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.4.0'
// Import the Firebase BoM
implementation platform('com.google.firebase:firebase-bom:29.1.0')
// Add the dependency for the Firebase SDK for Google Analytics
// When using the BoM, don't specify versions in Firebase dependencies
implementation 'com.google.firebase:firebase-analytics'
// Add the dependencies for any other desired Firebase products
// https://firebase.google.com/docs/android/setup#available-libraries
// Circle ImageView
implementation 'de.hdodenhof:circleimageview:3.1.0'
// Floating action button
implementation 'com.getbase:floatingactionbutton:1.10.1'
// Elastic view
implementation 'com.github.eschao:android-ElasticListView:v1.0'
}

Cannot resolve jitpack dependencies in android studio in the last gradle version

I get Failed to resolve: com.github.dogecoin:libdohj:v0.15.9 error and I don't know why. I also tried other jitpack dependencies. It works fine in my previous projects.
buildscript {
ext {
compose_version = '1.0.2'
}
repositories {
google()
maven { url "https://jitpack.io" }
mavenCentral()
}
dependencies {
classpath "com.android.tools.build:gradle:7.0.2"
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:1.5.21"
classpath "com.google.dagger:hilt-android-gradle-plugin:2.38.1"
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}
I added the maven { url "https://jitpack.io" } to the settings.gradle and it fixed the issue.
dependencyResolutionManagement {
repositoriesMode.set(RepositoriesMode.FAIL_ON_PROJECT_REPOS)
repositories {
google()
mavenCentral()
jcenter() // Warning: this repository is going to shut down soon
maven { url "https://jitpack.io" }
}
}
rootProject.name = "Crypto World"
include ':app'
In the new version (7.2) of Gradle some parts is changed, so you need to do like this:
1-Check your gradle version
2- Open the build.gradle(project:---)
3- If like the below code, go to next
plugins {
id 'com.android.application' version '7.1.2' apply false
id 'com.android.library' version '7.1.2' apply false
}
task clean(type: Delete) {
delete rootProject.buildDir
}
4- Open stting.gradle(---)
dependencyResolutionManagement {
repositoriesMode.set(RepositoriesMode.FAIL_ON_PROJECT_REPOS)
repositories {
google()
mavenCentral()
maven { url 'https://jitpack.io' }
}
5- Sync Now and finish

Error:Failed to resolve: runtime

so my project was working fine yesterday and I tried to open it today and it gives me that error , help would be much appreciated
I tried to search for a long time about whats going wrong but it seems all answers not working with me
Error:Failed to resolve: runtime
Open File
here is build.gradle(Project) file:
// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
repositories {
google()
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.0.1'
classpath 'com.google.gms:google-services:3.2.0'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
allprojects {
repositories {
jcenter()
maven {
url "https://maven.google.com" // Google's Maven repository
}
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}
and here is build app profile
apply plugin: 'com.android.application'
android {
compileSdkVersion 26
defaultConfig {
applicationId "com.example.android.writer"
minSdkVersion 15
targetSdkVersion 26
versionCode 1
versionName "1.0"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation 'com.android.support:appcompat-v7:26.1.0'
implementation 'com.android.support.constraint:constraint-layout:1.1.0'
implementation 'com.google.firebase:firebase-database:11.0.4'
implementation 'com.google.firebase:firebase-auth:11.0.4'
testImplementation 'junit:junit:4.12'
androidTestImplementation 'com.android.support.test:runner:1.0.1'
androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.1'
implementation 'com.rengwuxian.materialedittext:library:2.1.4'
implementation 'com.android.support:design:26.1.0'
implementation 'com.github.clans:fab:1.6.4'
implementation 'com.android.support:cardview-v7:26.1.0'
implementation 'com.firebase:firebase-client-android:2.5.2+'
}
apply plugin: 'com.google.gms.google-services'
Based on the answer in Android Studio 3.1.2 : Failed to resolve: runtime, try changing the order of imports in build.gradle project file as
allprojects {
repositories {
google()
maven {
url "https://maven.google.com" // Google's Maven repository
}
jcenter()
}
}
This worked for me.
This is very weird and took me almost 4-5 hours to fix. But, it turns out you need to put google() at the top and jcenter() at the bottom of repositories in build files for all modules. Maven can go in between and it'll be fixed.
allprojects {
repositories {
google()
maven {
url "https://maven.google.com" // Google's Maven repository
}
jcenter()
}
}
You must place google() as the 1st line. Reminder First line. I hope it will help you.
This worked for me
repositories {
google()`Goolge repo`
jcenter()
maven {
url 'https://maven.google.com/ `Google maven repo`
name 'Google'
}
}

Error:(1, 0) Plugin with id 'kotlin-android-extensions' not found

apply plugin: 'kotlin-android-extensions'.
When i add this extensions in android studio preview, give me this error
"Error:(1, 0) Plugin with id 'kotlin-android-extensions' not found.".
My build gradle
apply plugin: 'com.android.application'
android {
compileSdkVersion 26
buildToolsVersion "26.0.1"
defaultConfig {
applicationId "com.example.mohamed_elbaz.myapplication"
minSdkVersion 15
targetSdkVersion 26
versionCode 1
versionName "1.0"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation 'com.android.support:appcompat-v7:26.0.2'
implementation 'com.android.support.constraint:constraint-layout:1.0.2'
testImplementation 'junit:junit:4.12'
androidTestImplementation 'com.android.support.test:runner:1.0.1'
androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.1'
}
The build.gradle snippet you posted looks like the config inside your app module. What does the build.gradle in your project's root directory look like? To add the kotlin plugin dependencies it should look something like this:
buildscript {
ext.kotlin_version = '1.6.10'
repositories {
jcenter()
google()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.0.0-beta6'
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
allprojects {
repositories {
jcenter()
google()
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}
The important part being the line classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"which adds the kotlin plugins.
To use the plugin, you have to add it in your root build.gradle file
buildscript {
ext.kotlin_version = '1.1.60'
repositories {
jcenter()
maven {
url 'https://maven.google.com'
}
}
dependencies {
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
}
}
In Android Studio we can fix it in following ways:_
Using the plugins Domain Specific Language (DSL) in App Level Graddle:
plugins {
id "org.jetbrains.kotlin.android.extensions" version "1.4.21"
}
That's all to fix it.
But if you're using legacy plugin application, then add the following in App Level Gradle:
buildscript {
repositories {
maven {
url "https://plugins.gradle.org/m2/"
}
}
dependencies {
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:1.4.21"
}
}
apply plugin: "org.jetbrains.kotlin.android.extensions"
Hopefully, it'll be helpful!
put the below lines in build.gradle app
apply plugin: 'com.android.application'
apply plugin: 'kotlin-android'
and also do changes in build gradle by adding kotlin extension and path
//put the ext above the dependency line//
ext.kotlin_version = '1.4.31'
dependencies {
classpath "com.android.tools.build:gradle:4.2.1"
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}

jitpack.io dependencies are not working

I cannot get jitpack.io dependencies to work with gradle. I know there are other questions but none of the suggested tips helped. The problem is, jitpack.io dependencies are not working at all. In theory it should be simple... add the mavel { url ... } and the compile declarative. But i keep getting an error that the dependency cannot be resolved.
I updated android-studio, which suggested to update and then updated gradle. Since every jitpack.io dependency is not working, it must be related to the configuration of gradle overall. Unfortunately i have no clou where to start.
I tried different repositories, so that should not be the problem. I also checked the corresponding build logs.
Can anybody help me?
This are my whole gradle files, they should be fine.
// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
repositories {
jcenter()
mavenCentral()
maven { url "http://jitpack.io" }
}
dependencies {
classpath 'com.android.tools.build:gradle:2.2.2'
classpath 'com.neenbedankt.gradle.plugins:android-apt:1.8'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
allprojects {
repositories {
jcenter()
}
}
and
apply plugin: 'com.android.application'
apply plugin: 'com.neenbedankt.android-apt'
android {
compileSdkVersion 23
buildToolsVersion "23.0.0"
defaultConfig {
applicationId "patrickstummer.com.bonario_internal"
minSdkVersion 19
targetSdkVersion 23
versionCode 1
versionName "1.0"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
compile 'com.android.support:appcompat-v7:24.0.0-alpha2'
compile 'com.jakewharton:butterknife:8.4.0'
apt 'com.jakewharton:butterknife-compiler:8.4.0'
compile 'com.github.soroushjavdan:ApplicationLocker:62301ce0b4'
}
Add it in your root build.gradle at the end of repositories:
allprojects {
repositories {
...
maven { url "https://jitpack.io" }
}
}
Add the dependency
dependencies {
compile 'com.github.User:Repo:Tag'
}

Resources