Android Stripe integration - android

I have tried to integrate Stripe with my project. I have gone through the integration guide from https://stripe.com/docs/mobile/android. And I keep receiving an error Could not resolve com.stripe:stripe-android:6.1.2.
I have put into my build.gradle file Could not resolve com.stripe:stripe-android:8.0.0. Additionally, I have found the GitHub project that version varies from the one in the guide and I have tried it. The version number in the GitHub project is 8.0.0.
Full error log:
The short version of my dependencies in gradle:
dependencies {
...
implementation 'com.stripe:stripe-android:8.0.0'
...
}
Is there any additional maven repo or something that I should add to the gradle to be able to add this dependency to the project?

You might have enabled offline work for gradle,
Uncheck the box and sync the project again . It should fix the problem.

Related

I am facing issues compiling my project in Android Studio due to gradle

I have been trying to compile an app in Android Studio and it was working fine until I tried to add mobile ads.
Information about AS:
Android Studio Electric Eeel | 2022.1.1 Patch 1
Build #AI-221.6008.13.2211.9514443, built on January 21, 2023
I am following this article from Google Devs: https://developers.google.com/admob/android/quick-start#kotlin
I have read many questions and answers here on stackoverflow and also forums and blogs. The majority are from 2016-2021 and I understand a lot has changed since then...
According to the article, I have to include Google's Maven repository and Maven central repository in both my buildscript and allprojects sections on project-level build.gradle file.
My project-level build gradle contains a plugins { } section and when I paste the code form the article I get an error message saying that buldscript { } should be before plugins { }.
So I change that only to receive an error message saying "Build was configured to prefer settings repositories over project repositories but repository 'Google' was added by build file 'build.gradle'".
Following the article, I enter my module build.gradle file to add dependencies and I also update the AndroidManifest.xml with the information provided (I also have my actual AdMob ID).
I am also updating my MainActivity.kt file to include the necessary entries to preload Google Mobile Ads SDK.
But I am not able to compile anything anymore. I tried to move the buildscript{} and allprojects{} parts to the module build.gradle (within the app folder) but then I get following error:
A problem occurred evaluating project ':app'.
Could not find method android() for arguments [build_l8adkk1ea3ur5qn0u7k2w4gx$_run_closure1#20be5c4a] on project ':app' of type org.gradle.api.Project.
I have updated gradle to the latest version through Android Studio.
I have the latest version of Android Studio.
I have also specified the minSDK and targetSDK according to the article.
Not sure what to do or what the problem is. And all the solutions provided in various blogs/forums and here on stackoverflow seem outdated.
Thank you in advance

Failed to resolve compile "org.java-websocket:java-websocket:1.3.2"

I am developing chat application based on a demo from github. They used java-webocket:1.3.2, I was using java-websocket:1.3.1 but I got error because in 1.3.1 there is no setSocket() method. Then I changed in the gradle my version and suddenly I got this error
Failed to resolve compile "org.java-websocket:java-websocket:1.3.2"
I tried to find jar of this library but I could not find. I do not know why this is happening I am stuck with this error for 2 hours now, my internet is working fine but I cannot add java-websocket:1.3.2 to my dependencies but its working fine when I change back to 1.3.1
please add maven { url 'http://clojars.org/repo' } into your build.gradle that under the project then it will work.
did you add their maven repository to your build?
central only carries that artifact up to 1.3.0 (see link)
as per their website, you need to add their repo:
maven { url "http://clojars.org/repo" }
to your build.gradle

How to import Material Design on Android Studio project

I want to use this Material Design :
https://github.com/navasmdc/MaterialDesignLibrary
I have Imported it into my project and changed version numbers in build.gradle of it to versions of build.gradle of my app
Now there is a build error :
Error:(24, 13) Failed to resolve: com.nineoldandroids:library:2.4.+
I have searched and founded some solutions such as change 2.4.+ to 2.4.0 ! or this link, but they didn`t solve the problem
The question is :
When a project imported, what should be same in imported build.gradle versions and my app build.gradle versions ?!
My project compile in offline mode, Should I disable offline mode and let the Android Studio to download gradle files needed ?
As the link for the library says, do the following in the build.gradle. Copy the compile statement below in the dependencies tag. Your library name was wrong.
repositories {
jcenter()
}
dependencies {
compile 'com.github.navasmdc:MaterialDesign:1.5#aar'
}
You will find the dependencies in the build.gradle in the app folder not in the project folder.
You need to disable offline mode. After the library is imported you can go back to offline mode.
About the cannot resolve error:
nineoldandroid library is very old and now deprecated. I believe the material design library is using NineoldAndroid library. For some reason, it not able download this library. Why don't you add the nineoldandroid library first. If the material design library finds it then it may not try to download it.

How to make it possible to add my Library on GitHub to Android Gradle Files?

I have a project hosted on GitHub at https://github.com/BoardiesITSolutions/NavigationDrawerManager.
I've seen some projects on GitHub state adding it to their gradle file in Android Studio to the dependencies section but this doesn't seem to be working for me.
I have tried compile: 'com.github.boardiesitsolutions.NavigationDrawerManager:+' but it keeps saying it can't find it, I've also tried replacing the + with the version number but no luck, Android Studio keeps saying it can't find it. I've added the repository MavenCentral as well.
Is there something I need to do from GitHub to make it accessible for Gradle?
I don't see it on maven.
You can use this website to use non-mavenized libraries with Gradle.
Just add maven { url "https://jitpack.io" } to repositories section of build.gradle and use compile 'com.github.BoardiesITSolutions:NavigationDrawerManager:0b14c84445' in dependencies.

Adding Spring for android dependency to gradle + Android studio project

Official Spring for Android page mentions to add following dependency code.
dependencies {
compile 'org.springframework.android:spring-android:1.0.1.RELEASE'
}
which is latest version of build as of this time.(as per website)
I have added it in apps' build.gradle but I get an error as
Error:Failed to find: org.springframework.android:spring-android:1.0.1.RELEASE
What is the right way to do it?
I could add google play services as dependency in the same way.
Here is the correct dependency for the Rest Template module. I've corrected this on the Spring for Android project page. Thank you very much for pointing out this error.
dependencies {
compile 'org.springframework.android:spring-android-rest-template:1.0.1.RELEASE'
}
You can find correct and lastest version on spring site. Under the Quick Start title.
http://projects.spring.io/spring-android/

Categories

Resources