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.
Related
I've been working on an android app in Android Studio 3.0 canary 6 on another computer and using Github so that I can work on the project from any computer. Unfortunately, 3.0 doesn't scale correctly on my Surface Pro 4, so it is unusable. When I load the project in 2.3, I get an error that says something along the lines of "this gradle version requires Studio 3.0". I have tried tinkering with the gradle version in 2.3, but to no avail. Is it at all possible to totally convert the project for use in 2.3 (permanently; I would have no need to use 3.o again. I was just playing around with it.), and if so, how would I go about doing that? Thank you!
Yes, you can do that.
From 3.0 to 2.3.3 you must do the following changes:
Open your project on the Android Studio 2.3.
Expand Gradle Scripts, open gradle-wrapper.properties file and change the final piece of distributionUrl attribute to /gradle-3.3-all.zip . This may vary depending on your 2.x version.
Next, open build.gradle(Project: YOURPROJECT) and change the classpath inside dependencies {} to 'com.android.tools.build:gradle:2.3.3' . In repositories {} that is inside buildscript {} change google() to maven {url 'https://maven.google.com/' name 'Google' }. You should do this same thing to allprojects {} that is found just below dependencies {}.
Finally, open build.gradle(Module: app) and inside dependencies {} change the word "implementation" to "compile". Now sync your Gradle.
These changes will make the error you found, regarding the IDE version, to stop showing. You'll probably have other errors popping up that are related to sdk and dependencies versions. Just adjust the versioning of the sdk and dependencies to the ones that are used by your Android Studio 2.3. Some XML files may also show errors and you must manually correct those.
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 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.
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()
}
I'm following a tutorial to integrate facebook sdk in my android project, I'm using eclipse currently , tutorial is asking me to define repositories { mavenCentral() } in build.gradle file , but I don't know in which file I've to add this in eclipse... ant.properties, project.properties or any other file?
I've read some related threads , but I could not find in which file I've to change.
Defining Repository in Maven
maven repository eclipse project
You are working in Eclipse and the tutorial asks you to add the Maven central to your Gradle configuration which you (properly) don't have in Eclipse.
You basically have two options:
Get a Gradle plugin for Eclipse (like this: http://marketplace.eclipse.org/content/gradle-integration-eclipse-44)
Get Android Studio (http://developer.android.com/tools/studio/index.html), where Gradle is already an integrated part of the IDE.
Both options means that you have to get your head around what Gradle does, and how it works, but it'll properly be worth the effort.