Im new to testing in android studio, im was trying to setup the gradle for adding dependencies for Junit4.
However, the gradle console informs me "Could not find junit:junit:4.12."
It seems like gradle search the dependency in local folder instead of via internet, please inform how I should setup the gradle file for adding the dependecy for Junit.
You need internet connection -at least first time- to build project first time correctly (i really don't know why) !!!
so, to avoid that you may try download JUnit (required library) from here and add it manually to your application into ~[YourAppFolder]\app\libs
then rebuild your app.
Try commenting out //testCompile 'junit:junit:4.12'.
This will solve the problem if you don't have internet access as you run app after installing Android Studio. As soon as you have internet access, uncomment and run your app, there after everything remains fixed won't be needing internet access again.
I'm sure it works. Not sure why, anyway.
You have in your build.gradle:
buildscript {
repositories {
mavenCentral()
}
}
The above will fetch the plugin com.android.application. That's all it will do.
You should have the below to fetch all your dependencies:
repositories {
mavenCentral()
}
Related
I'm getting the following error in android studio when I add OKHTTP3 to the app level build.gradle and attempt to sync the build.gradle:
ERROR: Unable to resolve dependency for ':app#debug/compileClasspath': Could not resolve com.squareup.okhttp3:okhttp:4.4.0.
My code for implementing the dependency looks like this:
dependencies {
...
implementation 'com.squareup.okhttp3:okhttp:4.4.0'
...
}
This is the latest version of OKHTTP3 that I took from https://search.maven.org/artifact/com.squareup.okhttp3/okhttp/4.4.0/jar so this should work fine.
In the project level build.gradle I have jcenter() included within the repositories at both the buildscript and allprojects levels so I am unsure why I am receiving the above error as, from other stackoverflow questions, I can see that jcenter() is the maven central repository which this library comes from.
I have looked at all other stackoverflow questions on this matter but none of their solutions are working for me and I am receiving the same error regardless of any attempts.
I appreciate any suggestion anyone may have. Thank you in advance.
For anyone who runs into the above problem. This is what worked for me:
I did some research into the new Android Studio version as I figured out that I had done everything else correctly and the error was most likely to do with the recent Android Studio update. To fix the above solution, I toggled the build.gradle offline mode to off which resolved the entire problem.
To perform the same steps, this is taken from Android Studio's 3.6 blog post:
New location to toggle Gradle's offline mode To enable or disable Gradle's offline mode, first select View > Tool Windows > Gradle from the menu bar. Then, near the top of the Gradle window, click Toggle Offline Mode Gradle offline button in the Gradle panel..
This post can be found here https://developer.android.com/studio/preview/features#gradle-offline-ui
Just install new android studio 3.0 and I cannot find google cloud endpoint in android studio module.
Please how to set up Google Cloud Endpoint with the latest android studio 3.0
In This link the Read.MD That is Provided By GoogleCloudPlatform specifically for endpoints-framework-gradle-plugin has a few modifications due to issue they have found ... It Worked For me as i had the same issue , do the modifications until this line "If you have a particularly complicated buildscript classpath bringing in a lot of dependencies with cryptic error messages like"
clean and build your app and try to run your backend module
here is the link : https://github.com/GoogleCloudPlatform/endpoints-framework-gradle-plugin/blob/master/ANDROID_README.md
you might face an issue of jsr305 or so ...
add configurations.all in your build.gradle (app) as below
android {
configurations.all {
resolutionStrategy.force 'com.google.code.findbugs:jsr305:1.3.9'
}
}
you might another issue called
Can't start process working directory ............................. exploded-app folder doesn't exist
in order to solve this
modify the backend/backend.iml
Change:
<option name="WAR_DIR" value="$MODULE_DIR$/build/exploded-app" />
To:
<option name="WAR_DIR" value="$MODULE_DIR$/build/exploded-backend" />
if you faced anything let me know i have been going through hit and miss so i faced some issues that might occur to you
note: check the "Android Studio" section specially the "Run" part because it's telling you that you need to run the local development server using the gradle task appengineStart which starts the development server in non-blocking mode
I have the Android studio 3.0 Canary preview and am able to build fine there. When I try to build on jenkins with gradlew I receive
Could not find com.android.databinding:baseLibrary:3.0.0-alpha8.
I thought maybe the google() repo wasn't working but you'd think that would error out itself so I replaced
google()
with
maven { url 'https://maven.google.com' }
and I still get the same error. The only reference that I have in my build.gradle for databinding is
android {
dataBinding.enabled = true
}
my gradle wrapper has a distribution url of
distributionUrl=https\://services.gradle.org/distributions/gradle-4.1-milestone-1-all.zip
does anyone have an Idea of what I'm doing wrong or let me know if you need more information.
Same error here.
It's because you use Android Studio Canary Version.
Build Tools are include in package directly:
android-studio\gradle\m2repository\com\android\tools\build\gradle\3.0.0-alpha9
Are you sure that version exists? Looking here it seems like it doesn't.
Keep in mind that 3.0.0-alpha8 (alpha9 as of now) is for classpath 'com.android.tools.build:gradle', and not necessarily other dependencies
You can use the local gradle like this:
I am trying to develop an Android app using Pubnub's realtime API facilities. As per the documentation we need to add a gradle dependency line below within the build.gradle file:
compile 'com.pubnub:pubnub:4.1.0'
Strangely enough, Gradle is not able to satisfy this dependency. My repository configuration within the Gradle build script is as follows:
repositories {
jcenter()
}
I tried adding mavenCentral() instead of jcenter() but still no luck. Any help would be greatly appreciated.
Please note: I am adding only the relevant sections of the build.gradle file since I do not have the authority to paste the whole build script.
Also, this is my first time with the Android ecosystem - hence any help in pointing out obvious newbie errors would be great.
Did you right click on app, go to Open module settings, click on the Dependencies tab, click on the +, choose add module dependency and then ok?
I'm new to Android. How can I solve this error in Android studio 2.1?
It looks like you just import a project but never run it. What about open one of the XML file and run it?
And also, try to upgrade your Gradle to latest version, 2.1.0. It also looks like the sample code you've imported is created in previous version of Android Studio.
Try to find out if you can reach https://jcenter.bintray.com/ from your browser..
jcenter usually restricts access from some IP addresses. If you cannot reach the link from your browser, you can use a VPN connection (Kerio as a better solution) and try again and then rebuild your project. As an alternative, you can change
repositories {
jcenter()
}
to
repositories {
mavenCentral()
}
inside your project build.gradle file.