Hi,
I am building an Android application from an environment (windows) that has no internet access. Gradle is failing with “unable to resolve dependencies” error. Here is what I tried so far,
- I have a local maven repository setup with all the necessary dependencies.
- Configured build.gradle (both app and project) to point to mavenLocal()
- Configured build.gradle (both app and project) to point to maven { url ‘c:/Maven’ }
Gradle does not seem to care about my local repository and always goes to jcenter(), this is failing as the environment has not internet access.
Below is a sample error,
C:\h\Technology\Android\workspace\CodeWide\app\build.gradle
Error:(46, 17) Failed to resolve: junit:junit:4.12
<a href="openFile:C:/h/Technology/Android/workspace/CodeWide/app/build.gradle">Show in File</a><br><a href="open.dependency.in.project.structure">Show in Project Structure dialog</a>
Error:Failed to resolve: javax.inject:javax.inject:1
<a href="openFile:C:/h/Technology/Android/workspace/CodeWide/app/build.gradle">Open File</a><br><a href="open.dependency.in.project.structure">Show in Project Structure dialog</a>
Error:Failed to resolve: javax.annotation:javax.annotation-api:1.2
<a href="openFile:C:/h/Technology/Android/workspace/CodeWide/app/build.gradle">Open File</a><br><a href="open.dependency.in.project.structure">Show in Project Structure dialog</a>
Error:Failed to resolve: com.google.code.findbugs:jsr305:2.0.1
<a href="openFile:C:/h/Technology/Android/workspace/CodeWide/app/build.gradle">Open File</a><br><a href="open.dependency.in.project.structure">Show in Project Structure dialog</a>
Error:Failed to resolve: org.hamcrest:hamcrest-library:1.3
<a href="openFile:C:/h/Technology/Android/workspace/CodeWide/app/build.gradle">Open File</a><br><a href="open.dependency.in.project.structure">Show in Project Structure dialog</a>
Error:Failed to resolve: org.hamcrest:hamcrest-integration:1.3
<a href="openFile:C:/h/Technology/Android/workspace/CodeWide/app/build.gradle">Open File</a><br><a href="open.dependency.in.project.structure">Show in Project Structure dialog</a>
Error:Failed to resolve: com.squareup:javawriter:2.1.1
<a href="openFile:C:/h/Technology/Android/workspace/CodeWide/app/build.gradle">Open File</a><br><a href="open.dependency.in.project.structure">Show in Project Structure dialog</a>
Below is build.gradle
apply plugin: ‘com.android.application’
task wrapper(type: Wrapper) {
gradleVersion = ‘4.2.1’
}
android {
compileSdkVersion 26
buildToolsVersion "26.0.1"
defaultConfig {
applicationId "com.rbc.cwmt.codewide"
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’
}
}
}
buildscript {
repositories {
mavenLocal()
maven {
url “c:/Maven”
}
}
}
dependencies {
compile fileTree(include: [’*.jar’], dir: ‘libs’)
androidTestCompile(‘com.android.support.test.espresso:espresso-core:2.2.2’, {
exclude group: ‘com.android.support’, module: ‘support-annotations’
})
compile 'com.android.support:appcompat-v7:26.+'
compile 'com.android.support.constraint:constraint-layout:1.0.0-alpha7’
compile 'com.android.support:design:26.+'
testCompile ‘junit:junit:4.12’
}
Please point me in the right direction. Thanks in advance.