Build failure in android studio - android

i get this error when i make gradle online.
Error:Gradle:
FAILURE: Build failed with an exception.
* What went wrong:
Task 'testClasses' not found in project ':ProwessPride_V1.01'.
* Try:
Run gradle tasks to get a list of available tasks. Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.
Where ProwessPride_V1.01 is the jar file which i include in project.
I do Invalidate Caches/Restart in studio. rebuild and clean project also but i can't resolve this error. So please help me how can i solve it.
build.gradle
apply plugin: 'com.android.application'
android {
compileSdkVersion 23
buildToolsVersion "23.0.0"
defaultConfig {
applicationId "com.example.technopits.dcn"
minSdkVersion 17
targetSdkVersion 23
versionCode 1
versionName "1.0"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
compile fileTree(include: ['*.jar'], dir: 'libs')
compile 'com.android.support:appcompat-v7:23.0.0'
compile 'com.android.support:recyclerview-v7:23.0.0'
compile 'org.jbundle.util.osgi.wrapped:org.jbundle.util.osgi.wrapped.org.apache.http.client:4.1.2'
compile 'com.google.android.gms:play-services-gcm:7.3.0'
compile project(':ProwessPride_V1.01')
}
buil.gradle project
// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
repositories {
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:1.3.0'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
allprojects {
repositories {
jcenter()
}
}

Defining compile project(':ProwessPride_V1.01'), gradle is searching for a project with the same name in the settings.gradle.
Since it is a jar it is wrong.
Just remove this line.
compile project(':ProwessPride_V1.01')
If you adding the jar in the libs folder, this line is enough for you.
compile fileTree(include: ['*.jar'], dir: 'libs')

Follow the steps:
Undo any changes you made while adding the library (remove any dependancies or JAR's)
Drag n Drop the jar file in libs folder (inside android studio)
Clean Build

Related

Could not resolve androidx.databinding:databinding-compiler:3.5.3

I just Convert my project to androidX and project build successfully. But when I want to run that time it's created this error in android studio 3.5.3 with java enabled.
Here's my project gradle:
buildscript {
repositories {
google()
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.5.3'
classpath 'com.google.gms:google-services:4.3.3'
}
}
allprojects {
repositories {
google()
jcenter()
maven { url "https://jitpack.io" }
}
}
My module gradle file: All dependency I add here.
apply plugin: 'com.android.application'
android {
dataBinding {
enabled = true
}
compileSdkVersion 28
defaultConfig {
applicationId "com.exam.test"
minSdkVersion 16
targetSdkVersion 28
versionCode 1
versionName "1.0.0"
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
vectorDrawables.useSupportLibrary = true
multiDexEnabled true
signingConfig signingConfigs.release
}
}
compileOptions {
targetCompatibility JavaVersion.VERSION_1_8
sourceCompatibility JavaVersion.VERSION_1_8
}
//Dependencies
dependencies {
api 'com.google.android.material:material:1.0.0'
implementation fileTree(include: ['*.jar'], dir: 'libs')
implementation 'com.google.android.material:material:1.0.0'
implementation 'androidx.cardview:cardview:1.0.0'
implementation 'androidx.recyclerview:recyclerview:1.1.0'
implementation 'androidx.appcompat:appcompat:1.1.0'
implementation 'androidx.constraintlayout:constraintlayout:1.1.3'
testImplementation 'junit:junit:4.12'
implementation 'com.google.android.gms:play-services-location:16.0.0'
androidTestImplementation 'androidx.test.ext:junit:1.1.1'
implementation 'com.google.code.gson:gson:2.8.5'
implementation('com.crashlytics.sdk.android:crashlytics:2.8.0#aar') {
transitive = true
}
implementation 'androidx.biometric:biometric:1.0.1'
}
apply plugin: 'com.google.gms.google-services'
googleServices.disableVersionCheck = true
Build output: Here pom details not download when running the application
FAILURE: Build failed with an exception.
* What went wrong:
Could not determine the dependencies of task ':app:compileDebugJavaWithJavac'.
> Could not resolve all task dependencies for configuration ':app:debugAnnotationProcessorClasspath'.
> Could not resolve androidx.databinding:databinding-compiler:3.5.3.
Required by:
project :app
> Could not resolve androidx.databinding:databinding-compiler:3.5.3.
> Could not get resource 'https://dl.google.com/dl/android/maven2/androidx/databinding/databinding-compiler/3.5.3/databinding-compiler-3.5.3.pom'.
> Could not GET 'https://dl.google.com/dl/android/maven2/androidx/databinding/databinding-compiler/3.5.3/databinding-compiler-3.5.3.pom'.
> Remote host closed connection during handshake
* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.
these type of problems occure because of some library are not in harmoney with each other
then you should update maybe your problem will be gone .
i had same problem and now resolved it.
first upgrade your gradle
distributionUrl=https://services.gradle.org/distributions/gradle-5.6.4-all.zip
second update your kotlin-plugin
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:1.3.61"
third update your android studio to last version 3.6 or higher
note : this part maybe show error then you should update your constraint layout
implementation 'androidx.constraintlayout:constraintlayout:2.0.0-beta3'
i hope you resolve it
Finally, I solved it by increasing internet speed.
It's because of internet issues. As regular internet, it's created problems. But when I increased internet speed now the problem is solved.
Now it's working properly.

Could not resolve com.android.tools.build:gradle:3.3.2

I was trying to add firebase auth to my android project but getting this error.
I have tried adding 'com.google.firebase:firebase-core:16.0.3' too but its taking more than 40 mins and still not syncing the gradle.
This is build.gradle file:
apply plugin: 'com.android.application'
apply plugin: 'com.google.gms.google-services'
android {
compileSdkVersion 28
defaultConfig {
applicationId "myaid.startup"
minSdkVersion 21
targetSdkVersion 28
versionCode 1
versionName "1.0"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation 'com.android.support:appcompat-v7:28.0.0'
implementation 'com.android.support.constraint:constraint-layout:1.1.3'
implementation 'com.google.firebase:firebase-auth:16.0.3'
testImplementation 'junit:junit:4.12'
androidTestImplementation 'com.android.support.test:runner:1.0.2'
androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.2'
}
This is app.gradle file:
// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
repositories {
google()
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.3.2'
classpath 'com.google.gms:google-services:4.1.0'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
allprojects {
repositories {
google()
jcenter()
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}
This is the error:
FAILURE: Build failed with an exception.
What went wrong: A problem occurred configuring root project 'MyAid'.
Could not resolve all artifacts for configuration ':classpath'.
Could not resolve com.android.tools.build:gradle:3.3.2.
Required by:
project :
Could not resolve com.android.tools.build:gradle:3.3.2.
Could not get resource 'https://dl.google.com/dl/android/maven2/com/android/tools/build/gradle/3.3.2/gradle-3.3.2.pom'.
Could not GET 'https://dl.google.com/dl/android/maven2/com/android/tools/build/gradle/3.3.2/gradle-3.3.2.pom'.
Connection reset
Could not resolve com.android.tools.build:gradle:3.3.2.
Could not get resource 'https://jcenter.bintray.com/com/android/tools/build/gradle/3.3.2/gradle-3.3.2.pom'.
Could not GET 'https://jcenter.bintray.com/com/android/tools/build/gradle/3.3.2/gradle-3.3.2.pom'.
Connection reset
Try: Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.
Get more help at https://help.gradle.org
CONFIGURE FAILED in 2m 13s ERROR: Connection reset
I have resolved this problem by removing all my .gradle files, SDK files, .m2 files, .androidstudio files and then re-installing it.
Followed this answer: How to completely uninstall Android Studio
Please check your gradle's proxy settings. Enable it or disable it in the following file:
~/.gradle/gradle.properties
Like:
systemProp.https.proxyPort=1080
systemProp.http.proxyHost=127.0.0.1
systemProp.https.proxyHost=127.0.0.1
systemProp.http.proxyPort=1080
Advices:
If your connection to repositories is not stable, use a proxy
instead of direct connection.
If you used to use a proxy for
gradle, check if it is still working.

Getting Could not resolve com.github.npanigrahy:Custom-Calendar-View:v1.0. error while gradle build

I need some help for integrating library.
I'm getting following error while compiling android project:
Could not resolve com.github.npanigrahy:Custom-Calendar-View:v1.0.
Following is detailed files:
Top-level build.gradle
// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
repositories {
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:2.2.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" }
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}
project build.gradle
apply plugin: 'com.android.application'
android {
compileSdkVersion 24
buildToolsVersion '24.0.1'
defaultConfig {
applicationId "com.test.test"
minSdkVersion 16
targetSdkVersion 23
versionCode 1
versionName "1.0"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
compile fileTree(include: ['*.jar'], dir: 'libs')
testCompile 'junit:junit:4.12'
compile 'com.github.npanigrahy:Custom-Calendar-View:v1.0'
compile 'com.android.support:appcompat-v7:24.2.1'
compile 'com.android.support:cardview-v7:24.2.1'
compile 'com.android.support:design:24.2.1'
compile 'com.android.support:support-v4:24.2.1'
compile 'com.android.support:recyclerview-v7:24.+'
}
stack trace
Error:A problem occurred configuring project ':app'.
Could not resolve all dependencies for configuration ':app:_debugApkCopy'.
Could not resolve com.github.npanigrahy:Custom-Calendar-View:v1.0.
Required by:
STYYLE:app:unspecified
> Could not resolve com.github.npanigrahy:Custom-Calendar-View:v1.0.
> Could not get resource 'https://jcenter.bintray.com/com/github/npanigrahy/Custom-Calendar-View/v1.0/Custom-Calendar-View-v1.0.pom'.
> Could not GET 'https://jcenter.bintray.com/com/github/npanigrahy/Custom-Calendar-View/v1.0/Custom-Calendar-View-v1.0.pom'.
> RSA premaster secret error
> Could not resolve com.github.npanigrahy:Custom-Calendar-View:v1.0.
> Could not get resource 'https://repo1.maven.org/maven2/com/github/npanigrahy/Custom-Calendar-View/v1.0/Custom-Calendar-View-v1.0.pom'.
> Could not GET 'https://repo1.maven.org/maven2/com/github/npanigrahy/Custom-Calendar-View/v1.0/Custom-Calendar-View-v1.0.pom'.
> RSA premaster secret error
> Could not resolve com.github.npanigrahy:Custom-Calendar-View:v1.0.
> Could not get resource 'https://jitpack.io/com/github/npanigrahy/Custom-Calendar-View/v1.0/Custom-Calendar-View-v1.0.pom'.
> Could not GET 'https://jitpack.io/com/github/npanigrahy/Custom-Calendar-View/v1.0/Custom-Calendar-View-v1.0.pom'.
> RSA premaster secret error
Thanks in advance.
In my case, issue was JDK android studio was using.
After changing it to embedded JDK in project settings,error was gone.

Dagger 2 and Android Data Binding conflict

When adding both Dagger 2 and Android Data Binding to my project I get some the below build time errors. It seems that this is a known problem (see [1] or [2]) as I get the exact same errors. Unfortunately I was not able to solve them (like some others). Does someone have a full working setup with current versions of Dagger 2 and Data Binding, and can help?
Here the errors:
C:\Users\Kai\AndroidStudioProjects\WearCompass\mobile\src\main\java\com\comparilla\wearcompass\ui\navigation\InfoPanelFragment.java:12: error: package com.comparilla.wearcompass.databinding does not exist
import com.comparilla.wearcompass.databinding.FragmentInfoPanelBinding;
^
C:\Users\Kai\AndroidStudioProjects\WearCompass\mobile\src\main\java\com\comparilla\wearcompass\ui\navigation\InfoPanelViewModel.java:8: error: cannot find symbol
import com.comparilla.wearcompass.BR;
^
symbol: class BR
location: package com.comparilla.wearcompass
C:\Users\Kai\AndroidStudioProjects\WearCompass\mobile\src\main\java\com\comparilla\wearcompass\MobileApplication.java:7: error: cannot find symbol
import com.comparilla.wearcompass.di.components.DaggerMobileApplicationComponent;
^
symbol: class DaggerMobileApplicationComponent
location: package com.comparilla.wearcompass.di.components
C:\Users\Kai\AndroidStudioProjects\WearCompass\mobile\src\main\java\com\comparilla\wearcompass\di\components\MobileActivityComponent.java:15: error: com.comparilla.wearcompass.common.services.HeadingService cannot be provided without an #Inject constructor or from an #Provides-annotated method.
void inject(InfoPanelFragment fragment);
^
com.comparilla.wearcompass.common.services.HeadingService is injected at
com.comparilla.wearcompass.di.modules.ActivityModule.provideInfoPanelViewModel(headingService, …)
com.comparilla.wearcompass.ui.navigation.InfoPanelViewModel is injected at
com.comparilla.wearcompass.ui.navigation.InfoPanelFragment.mViewModel
com.comparilla.wearcompass.ui.navigation.InfoPanelFragment is injected at
com.comparilla.wearcompass.di.components.MobileActivityComponent.inject(fragment)
4 errors
FAILED
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':mobile:compileDebugJavaWithJavac'.
> Compilation failed; see the compiler error output for details.
* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.
BUILD FAILED
My project build.gradle:
// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
repositories {
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:2.1.2'
classpath 'com.neenbedankt.gradle.plugins:android-apt:1.8'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
allprojects {
repositories {
jcenter()
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}
And the application build.gradle:
apply plugin: 'com.android.application'
apply plugin: 'com.neenbedankt.android-apt'
android {
compileSdkVersion 24
buildToolsVersion "23.0.3"
dataBinding {
enabled = true
}
defaultConfig {
applicationId "com.comparilla.wearcompass"
minSdkVersion 21
targetSdkVersion 24
versionCode 1
versionName "1.0"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
compile fileTree(include: ['*.jar'], dir: 'libs')
wearApp project(':wear')
testCompile 'junit:junit:4.12'
// to enable BuildConfig.DEBUG in the common library
// see https://stackoverflow.com/a/29163361/166229
releaseCompile project(path: ':common', configuration: 'release')
debugCompile project(path: ':common', configuration: 'debug')
compile 'com.android.support:appcompat-v7:24.0.0'
compile 'com.google.android.gms:play-services-maps:9.0.2'
compile 'com.android.support:design:24.0.0'
compile 'com.android.support:preference-v14:24.0.0'
compile 'com.google.dagger:dagger:2.5'
apt 'com.google.dagger:dagger-compiler:2.5'
provided 'javax.annotation:jsr250-api:1.0'
}
I also tried to provided instead of apt in apt 'com.google.dagger:dagger-compiler:2.5', without success. Also commenting out apply plugin: 'com.neenbedankt.android-apt' did not help (like suggested in the provided resources).
I do have Dagger 2 and DataBinding configured in the same project and it's working without any problem.
You do have error in Dagger 2 configuration. The HeadingService you're trying to inject can't be created because you haven't provided it with #Provides annotation and also the class doesn't have #Inject annotation on constructor.

Android Build Gradle doesn't complete

I had a problem to run android-studios build gradle, so I tested many solution but unfortunately I couldn't solve my problem:
Now i uninstall my old Android studio and Android-sdk , then I download android studio 1.5.1 that contains default SDK .
I install them and I create an empty project , But it take 30 minutes to build project, I will add dialog window that shown in this period of time .
Finally project created with this error :
Error:(23, 17) Failed to resolve: junit:junit:4.12
Could any one help me ,please ?
build.gradle file content:
apply plugin: 'com.android.application'
android {
compileSdkVersion 23
buildToolsVersion "23.0.1"
defaultConfig {
applicationId "com.armangar.app.fortest"
minSdkVersion 23
targetSdkVersion 23
versionCode 1
versionName "1.0"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
compile fileTree(include: ['*.jar'], dir: 'libs')
androidTestCompile 'junit:junit:4.12'
compile 'com.android.support:appcompat-v7:23.1.1'
}
top build.gradle file content:
// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
repositories {
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:1.5.0'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
allprojects {
repositories {
jcenter()
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}
testCompile is the configuration for unit tests (located in src/test) and androidTestCompile is used for the test api (located in src/androidTest).
The main distinction between the two is that test runs in a regular Java JVM, and androidTest tests run on an Android device (or an emulator).
So, use
testCompile 'junit:junit:4.12'
instead of
androidTestCompile 'junit:junit:4.12'
source: http://tools.android.com/tech-docs/unit-testing-support
I think you have SSL problem.
Try by replacing
jcenter { url 'http://jcenter.bintray.com' }
with
jcenter()
in both repository blocks in build.gradle file and try to build gradle again.
I change jcenter() to mavenCentral() in build.gradle .
So my problem solved
EDIT:
This issue was related to my proxy . So I could not download from jcenter().
If you have a problem same this one, please check your Internet proxy .

Categories

Resources