Add a new library in android - android

I need to make a floating circular menu
And I need to add a library to my project
Finally i found a library that would help me do that
implementation 'com.github.recruit-lifestyle:FloatingView:2.4.4'
When i add this library in my gradle i get an error
This is the error :
ERROR: Unable to resolve dependency for ':app#debug/compileClasspath': Could not resolve com.github.recruit-lifestyle:FloatingView:2.4.4.
ERROR: Unable to resolve dependency for ':app#debugAndroidTest/compileClasspath': Could not resolve com.github.recruit-lifestyle:FloatingView:2.4.4.
ERROR: Unable to resolve dependency for ':app#debugUnitTest/compileClasspath': Could not resolve com.github.recruit-lifestyle:FloatingView:2.4.4.
does anyone know why is that?!
And I have tried to add other libraries, but every time I get the same error
How can i solve this problem?
Edit1
This is my build.gradle
apply plugin: 'com.android.application'
android {
compileSdkVersion 28
buildToolsVersion "28.0.3"
defaultConfig {
applicatiomId "com.example.project"
minSdkVersion 16
targetSdkVersion 28
versionCode 1
versionName "1.0"
testInstrumentationRunner
"androidx.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefultProguardFile ('proguard-android-optimize.txt'), 'proguard-rules.pro'
}
}
}
dependency {
implementation fileTree (dir: 'libs', include: ['*.jar])
implementation 'androidx.appcompat:appcompat:1.0.2'
implementation 'androidx.constraintlayout:constraintlayouy:1.1.3'
testImplementation 'junit:junit:4.12'
androidTestImplementation 'androidx.test.ext:junit::1.1.0'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.1.1'
//This is the library I want to add
implementation 'com.github.recruit-lifestyle:FloatingView:2.4.4'
}
Edit2
My build.gradle (Project)
buildscript {
repositories {
google ()
jcenter ()
}
dependency {
classpath 'com.android.tools.build:gradle:3.5.3'
}
}
allprojects {
repositoriss {
google ()
jcenter ()
maven {
url "https://jitpack.io"
}
}
}
task clean (type: Delete){
delete rootProject.buildDir
}

Try adding below one:
dependencies {
implementation 'com.github.recruit-lifestyle:floatingview:2.4.5'
}
I checked it here and found that this one is working.
Also add this to your build.gradle (project)
allprojects {
repositories {
...
maven { url 'https://jitpack.io' }
}
}
Also make sure to uncheck the Gradle Offline option in Settings.
File > Settings > Build, Execution, Deployment > Gradle > Uncheck Offline Work

Related

Failed to resolve: org.jitsi.react:jitsi-meet-sdk:3.+

I tried changing the compilesdk and mindsdk versions as told here. I read all the other posts regarding the same but none worked so far. I have looked at the previous answers ans1 and ans2 . They didn't helped.
When I try to run the project it throws multplie errors. I think the main problem is because of this one
Could not find any matches for org.jitsi.react:jitsi-meet-sdk:3.+ as no versions of org.jitsi.react:jitsi-meet-sdk are available.
build.gradle(My application)
// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
repositories {
google()
mavenCentral()
maven {
url "https://github.com/jitsi/jitsi-maven-repository/raw/master/releases"
}
}
dependencies {
classpath "com.android.tools.build:gradle:7.0.4"
classpath 'com.google.gms:google-services:4.3.10'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}
build.gradle(app)
plugins {
id 'com.android.application'
id 'com.google.gms.google-services'
}
android {
compileSdk 30
defaultConfig {
applicationId "com.example.myapplication"
minSdk 21
targetSdk 30
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
}
}
dependencies {
implementation 'androidx.appcompat:appcompat:1.2.0'
implementation 'com.google.android.material:material:1.3.0'
implementation 'androidx.constraintlayout:constraintlayout:2.0.4'
implementation 'com.google.firebase:firebase-auth:19.2.0'
implementation 'com.google.firebase:firebase-common-ktx:20.0.0'
implementation 'com.google.firebase:firebase-firestore:24.0.0'
testImplementation 'junit:junit:4.+'
androidTestImplementation 'androidx.test.ext:junit:1.1.2'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.3.0'
implementation platform('com.google.firebase:firebase-bom:29.0.3')
implementation ('org.jitsi.react:jitsi-meet-sdk:3.+') { transitive = true }
}
Any help is appreciated.
I find a workaround for this. You've to paste the maven URL into settings.gradle file. Some other user was facing a problem similar to this here . I did the same and it's working fine.
+1 / Failed to resolve: org.jitsi.react:jitsi-meet-sdk:3.+
5 min
I had added the maven dependency in the wrong place. It goes in the project gradle, under allprojects->repositories.
new fail
A problem occurred evaluating root project 'My Application'.
Build was configured to prefer settings repositories over project repositories but repository 'maven' was added by build file 'build.gradle'
For me the problem was with the SDK version
I replaced this line
implementation ('org.jitsi.react:jitsi-meet-sdk:+') { transitive = true }
with this line
implementation ('org.jitsi.react:jitsi-meet-sdk:5.1.0') { transitive = true }
If you are using React-Native < 0.60, you should use a version < 2.0.0.
For versions higher than 2.0.0, you need to add the following piece of code in your metro.config.js file to avoid conflicts between react-native-jitsi-meet and react-native in metro bundler.
const blacklist = require('metro-config/src/defaults/blacklist');
module.exports = {
resolver: {
blacklistRE: blacklist([
/ios/Pods/JitsiMeetSDK/Frameworks/JitsiMeet.framework/assets/node_modules/react-native/.*/,
]),
},
};
ref: https://github.com/skrafft/react-native-jitsi-meet

error when adding one signal dependency

I want to use OneSignal in my android app but I get some errors after adding OneSignal dependency in my gradle file.
I am using Android Studio 3.1.
This is my gradle file:
android {
compileSdkVersion 27
defaultConfig {
applicationId "com.example.nasser.myapplication"
minSdkVersion 14
targetSdkVersion 27
versionCode 1
versionName "1.0"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
postprocessing {
removeUnusedCode false
removeUnusedResources false
obfuscate false
optimizeCode false
proguardFile 'proguard-rules.pro'
}
}
}
}
dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation 'com.android.support:appcompat-v7:26.0.0-alpha1'
implementation 'com.android.support.constraint:constraint-layout:1.0.2'
testImplementation 'junit:junit:4.12'
androidTestImplementation 'com.android.support.test:runner:0.5'
androidTestImplementation 'com.android.support.test.espresso:espresso- core:2.2.2'
compile 'com.onesignal:OneSignal:[3.6.2, 3.99.99]'
}
and this is project's build.gradle file:
buildscript {
repositories {
google()
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.1.0-alpha01'
// 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' }
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}
now when i sync gradle file i get many errors like this one:
Could not resolve com.android.support:support-v4:[26.0.0,26.2.0).
Required by:
project :app > com.onesignal:OneSignal:3.6.5
> Could not resolve com.android.support:support-v4:[26.0.0,26.2.0).
> Failed to list versions for com.android.support:support-v4.
> Unable to load Maven meta-data from https://dl.google.com/dl/android/maven2/com/android/support/support-v4/maven-metadata.xml.
> Could not HEAD 'https://dl.google.com/dl/android/maven2/com/android/support/support-v4/maven-metadata.xml'.
> dl.google.com:443 failed to respond
You should add the google maven in your project build.gradle:
repositories {
maven { url 'https://maven.google.com' }
}
You need to remember that OneSignal automatically adds the following dependencies:
com.google.android.gms - Version 11.2.+
com.android.support - Version 26.1.+
So, all dependencies must have matching versions.
To force the support library which your selected version, you can use the following:
// Must use 26.0.0 or newer if you have targetSdkVersion 26
def androidSupportVersion = '26.1.+'
compile("com.android.support:support-v4:${androidSupportVersion}") {
force = true
}
compile("com.android.support:customtabs:${androidSupportVersion}") {
force = true
}
Read more at Troubleshooting Android.
p.s: You should fix your build.gradle.
I met the same problem in Android Studio 3.1, and all build tasks are failed.
Finally I found my problem is caused by Gradle proxy setting. The solution:
Open the file ~/.gradle/gradle.properties, and delete proxy settings in it if any, like
systemProp.https.proxyPort=50846
systemProp.http.proxyHost=127.0.0.1
systemProp.https.proxyHost=127.0.0.1
systemProp.http.proxyPort=50846
then restart Android Studio, build tasks works now.

Android: loopj is not importing

I am using android studio, when am trying to add dependency
compile 'com.loopj.android:android-async-http:1.4.9'
and sync the project am getting an error
Error:Failed to find: com.loopj.android:android-async-http:1.4.9
Open FileOpen in Project Structure dialog
when i open the project structure -> Dependency its showing under the library
But the problem is that the library is not syncing.
when i try to clean the project am getting error like
Error:A problem occurred configuring root project 'Frendy'.
Could not resolve all dependencies for configuration ':_debugCompile'.
Could not find com.loopj.android:android-async-http:1.4.9.
Searched in the following locations:
file:/C:/Users/Binil/AppData/Local/Android/sdk/extras/android/m2repository/com/loopj/android/android-async-http/1.4.9/android-async-http-1.4.9.pom
file:/C:/Users/Binil/AppData/Local/Android/sdk/extras/android/m2repository/com/loopj/android/android-async-http/1.4.9/android-async-http-1.4.9.jar
file:/C:/Users/Binil/AppData/Local/Android/sdk/extras/google/m2repository/com/loopj/android/android-async-http/1.4.9/android-async-http-1.4.9.pom
file:/C:/Users/Binil/AppData/Local/Android/sdk/extras/google/m2repository/com/loopj/android/android-async-http/1.4.9/android-async-http-1.4.9.jar
Required by:
:Frendy:unspecified
Can any one please help me.
Add Maven Repositories it should work, its described at https://github.com/loopj/android-async-http in gradle section
this is example of my gradle :
apply plugin: 'com.android.application'
repositories {
maven {
url 'https://repo1.maven.org/maven2/'
}
}
android {
compileSdkVersion 23
buildToolsVersion "23.0.1"
defaultConfig {
applicationId "com.mine.android"
minSdkVersion 10
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:23.1.1'
compile 'com.loopj.android:android-async-http:1.4.9'
}
}
Just add below code in build.gradle
repositories {mavenCentral()maven {url"https://oss.onatype.org/content/repositories/snapshots/" } }

Cannot add CircularReveal library by ozodrukh in Android studio

I am using Android Studio 1.1.0 and am trying to add CircularReveal library .I have followed the instructions mentioned there.
my build.gradle(Module: app) is :
apply plugin: 'com.android.application'
android {
compileSdkVersion 21
buildToolsVersion "21.1.1"
defaultConfig {
applicationId "com.geronimo.myapplication"
minSdkVersion 18
targetSdkVersion 21
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:21.0.3'
compile 'com.github.ozodrukh:CircularReveal:(latest-release)#aar'
}
I have added the repository in `build.gradle(Project: MyApplication3)`
// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
repositories {
jcenter()
maven {
url "https://jitpack.io"
}
}
dependencies {
classpath 'com.android.tools.build:gradle:1.1.0'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
allprojects {
repositories {
jcenter()
maven {
url "https://jitpack.io"
}
}
}
The error that I am getting is
D:\Workspaces\AndroidStudio\Studio1.0\MyApplication3\app\build.gradle
Error:(24, 13) Failed to resolve: com.github.ozodrukh:CircularReveal:(latest-release)
Show in File<br>Show in Project Structure dialog
I have tried variations of the dependency too ie:
compile 'com.github.ozodrukh:CircularReveal:(latest-release)#aar'
compile 'com.github.ozodrukh:CircularReveal:(v1.0.4)#aar'
compile 'com.github.ozodrukh:CircularReveal-v1.0.4 #aar'
The error always remains as Failed to resolve...
Is there any other way to import a remote aar file and to add this dependency?
Copy #aar file to the libs directory manually. Then by going to
Files>Project Structure>Dependency
on the right red cross choose library dependency. This will prompt you a dialog where you can search for your dependency and add them.
or
download circularReveal library from github and import it as Module Dependency from Files>Project Structure>Dependency
You need to put only version number without brackets and 'v' char
com.github.ozodrukh:CircularReveal:1.0.4#aar
I had the same problem before. After I checked, I saw that the problem was the miniSDKversion which was lower than 15. Once I changed it to 15, it worked.
minSdkVersion 14 (change it to 15 or above)
targetSdkVersion 26
Then paste this to your library dependency
implementation ('com.github.ozodrukh:CircularReveal:2.0.1#aar') {
transitive = true;
}
Also add remote maven url
repositories {
maven {
url "https://jitpack.io"
}
}

Android Studio gradle sync failed to find library

So I'm working on project in AndroidStudio 0.8.1 beta and I want to make use of a library I found on github (https://github.com/derekbrameyer/android-betterpickers). I add the dependency like it says inside the README.md but when I try to sync the project with the gradle files it says:
Failed to find: com.doomonafireball.betterpickers:library:1.5.2
Here is my build.gradle file:
apply plugin: 'com.android.application'
buildscript {
repositories {
maven { url 'http://repo1.maven.org/maven2' }
}
}
repositories {
mavenCentral()
}
android {
compileSdkVersion 19
buildToolsVersion '19.1.0'
defaultConfig {
applicationId 'gtsarandum.syncc'
minSdkVersion 14
targetSdkVersion 19
versionCode 1
versionName '1.0'
}
buildTypes {
release {
runProguard false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
productFlavors {
}
}
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
compile 'com.android.support:support-v4:19.+'
compile project(':extendedCalendarView')
compile project(':src')
compile 'com.github.gabrielemariotti.cards:library:1.7.3'
compile 'com.github.gabrielemariotti.cards:library-extra:1.7.3'
compile 'com.doomonafireball.betterpickers:library:1.5.2'
}
Last time I had this problem with gabriellemariotti.cards:libraryd:1.7.3 I added maven { url 'http://repo1.maven.org/maven2' } inside the buildscript as you can see above.
Is there something else I have to add? If not, how do I solve this problem?
Many thanks in advance!
My fix was to add:
allprojects {
repositories {
mavenCentral()
}
}
to the build.gradle file
Try alter 'gradle.settings' with an include statement for the path/lib not being found.
Don't use HTTP Proxy. Android Studio -> File -> Settings-> HTTP Proxy -> No proxy

Categories

Resources