I'm trying to generate a signed apk and the log keeps showing me the following error:
:app:compileReleaseJavaWithJavac
Note: Some input files use or override a deprecated API.
Note: Recompile with -Xlint:deprecation for details.
:app:compileReleaseNdk UP-TO-DATE
:app:compileReleaseSources
:app:collectReleaseMultiDexComponents
:app:proguardRelease
Warning:com.google.android.gms.internal.zzac: can't find referenced class android.net.http.AndroidHttpClient
Warning:com.google.android.gms.internal.zzw: can't find referenced method 'void addHeader(java.lang.String,java.lang.String)' in program class com.google.android.gms.internal.zzw$zza
Warning:com.google.android.gms.internal.zzw$zza: can't find referenced method 'void setURI(java.net.URI)' in program class com.google.android.gms.internal.zzw$zza
Warning:com.ironsource.mobilcore.j: can't find referenced method 'void setLatestEventInfo(android.content.Context,java.lang.CharSequence,java.lang.CharSequence,android.app.PendingIntent)' in library class android.app.Notification
Warning:com.mopub.volley.toolbox.HttpClientStack: can't find referenced method 'void addHeader(java.lang.String,java.lang.String)' in program class com.mopub.volley.toolbox.HttpClientStack$HttpPatch
Warning:com.mopub.volley.toolbox.HttpClientStack$HttpPatch: can't find referenced method 'void setURI(java.net.URI)' in program class com.mopub.volley.toolbox.HttpClientStack$HttpPatch
Warning:com.mopub.volley.toolbox.Volley: can't find referenced class android.net.http.AndroidHttpClient
Warning:there were 4 unresolved references to classes or interfaces.
You may need to add missing library jars or update their versions.
If your code works fine without the missing classes, you can suppress
the warnings with '-dontwarn' options.
(http://proguard.sourceforge.net/manual/troubleshooting.html#unresolvedclass)
Warning:there were 4 unresolved references to program class members.
Your input classes appear to be inconsistent.
You may need to recompile the code.
(http://proguard.sourceforge.net/manual/troubleshooting.html#unresolvedprogramclassmember)
Warning:there were 1 unresolved references to library class members.
You probably need to update the library versions.
(http://proguard.sourceforge.net/manual/troubleshooting.html#unresolvedlibraryclassmember)
Exception while processing task
java.io.IOException: Please correct the above warnings first.
at proguard.Initializer.execute(Initializer.java:473)
at proguard.ProGuard.initialize(ProGuard.java:233)
at proguard.ProGuard.execute(ProGuard.java:98)
at proguard.gradle.ProGuardTask.proguard(ProGuardTask.java:1074)
at com.android.build.gradle.tasks.AndroidProGuardTask.doMinification(AndroidProGuardTask.java:139)
at com.android.build.gradle.tasks.AndroidProGuardTask$1.run(AndroidProGuardTask.java:115)
at com.android.builder.tasks.Job.runTask(Job.java:48)
at com.android.build.gradle.tasks.SimpleWorkQueue$EmptyThreadContext.runTask(SimpleWorkQueue.java:41)
at com.android.builder.tasks.WorkQueue.run(WorkQueue.java:227)
at java.lang.Thread.run(Thread.java:745)
:app:shrinkReleaseMultiDexComponents FAILED
Error:Execution failed for task ':app:shrinkReleaseMultiDexComponents'.
> java.io.IOException: The output jar [<project_path>\app\build\intermediates\multi-dex\release\componentClasses.jar] must be specified after an input jar, or it will be empty.
Below is my app-level build.gradle:
apply plugin: 'com.android.application'
android {
compileSdkVersion 23
buildToolsVersion "23.0.1"
defaultConfig {
applicationId "com.my.app"
minSdkVersion 14
targetSdkVersion 23
versionCode 25
versionName "2.5"
// Enabling multidex support.
multiDexEnabled true
}
buildTypes {
release {
minifyEnabled true
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
dexOptions {
incremental true
javaMaxHeapSize "2048M"
}
}
repositories {
mavenCentral()
maven { url "https://jitpack.io" }
}
dependencies {
compile 'com.android.support:multidex:1.0.1'
compile 'com.android.support:appcompat-v7:23.0.1'
compile 'com.android.support:design:23.0.1'
compile 'com.android.support:recyclerview-v7:23.0.1'
compile 'com.google.android.gms:play-services:8.1.0'
compile 'com.google.code.gson:gson:2.3.1'
compile 'com.squareup.okhttp:okhttp:2.4.0'
compile 'com.facebook.android:facebook-android-sdk:4.2.0'
compile 'me.dm7.barcodescanner:zxing:1.7.2'
compile 'de.hdodenhof:circleimageview:1.3.0'
compile 'com.scottyab:secure-preferences-lib:0.1.3'
compile 'com.soundcloud.android:android-crop:1.0.0#aar'
compile('com.afollestad.material-dialogs:core:0.8.1.0#aar') {
transitive = true
}
compile('com.mopub:mopub-sdk:3.13.0#aar') {
transitive = true
}
compile project(':android-support-v4-preferencefragment')
compile project(':circular_progress_bar')
compile files('libs/mobilecore_V1.1.jar')
compile files('libs/libAdapterSDKMoPub.jar')
compile files('libs/adcolony.jar')
}
And my 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:1.3.0'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
allprojects {
repositories {
jcenter()
}
}
I have tried with other version of gradle like 1.4.0-beta1', 1.4.0-beta2, and 1.3.1 still no luck.
There is some info right there in your trace --
Warning:there were 4 unresolved references to classes or interfaces.
You may need to add missing library jars or update their versions.
If your code works fine without the missing classes, you can suppress
the warnings with '-dontwarn' options.
(http://proguard.sourceforge.net/manual/troubleshooting.html#unresolvedclass)
At least part of your problem is that AndroidHttpClient was removed in API 23, and at least one of your libraries depends on it. You have three options.
1) You can include the following in your build.gradle file. Which includes the legacy library in your apk. See Apache HTTP Client Removal.
android {
useLibrary 'org.apache.http.legacy'
}
2) You can lower your target and compile sdk to 22 instead of 23. That should allow you to compile, or at least resolve the AndroidHttpClient issue until the libraries are updated to not require it.
3) You can add -dontwarn commands to your proguard file to suppress the warns to get a build. As noted in the documentation, this can be dangerous if you aren't certain the warnings can be safely ignored. I am not certain if ignoring warnings stemming from the removal of HttpClient and associated classes is safe or not. It might lead to an unstable build when running on M, but should be safe for L and below because those classes exist on devices at that API level.
ADDED:
For whoever struggles the same, keep in mind that you'll have to lower your builToolsVersion and com.android.support in the dependency to 22.0.1.
this is a very easy problem to solve. the problem rises when you are developing an app and somewhere in the middle you update your SDK. this is fine but you what you don't know the gradle configuration for you project should be up to date. so simply create a new project and look at your classpath which for mine was com.android.tools.build:gradle:1.3.1 in the project but now new projects class path are classpath 'com.android.tools.build:gradle:1.5.0' . the other thing to consider is compileSdkVersion , buildToolsVersion , targetSdkVersion. you should also check if your libraries version are up to date. you can find their versions by simply opening you SDK-manager.
so to wrap it up:
this is what your project gradle should be updated:
buildscript {
repositories {
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:1.5.0' //update this section to the lates gradle core available
}
}
and this is the sections in gradle module level file that should be updated:
android {
compileSdkVersion 23 // update this one
buildToolsVersion "23.0.2" // update this one
defaultConfig {
applicationId "ranjbar.hadi.something"
minSdkVersion 14
targetSdkVersion 23 // update this one
versionCode 1
versionName "1.0"
}
buildTypes {
release {
minifyEnabled true
proguardFiles getDefaultProguardFile('proguard-android.txt'),
'proguard-rules.pro'
}
}
}
hope this helps
Related
Android project Code base is full java and dagger 2 is implemented in java as well. I am integrating kotlin in the code and each time I rebuild, Dagger gives errors. (Added below)
code:
build.gradle (project)
buildscript {
ext {
kotlin_version = "1.7.10"
}
repositories {
google()
mavenCentral()
}
dependencies {
classpath 'com.google.gms:google-services:4.3.10'
classpath 'com.android.tools.build:gradle:7.2.1'
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
}
}
allprojects {
repositories {
google()
mavenCentral()
}
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}
build.gradle (app)
apply plugin: 'com.android.application'
apply plugin: 'com.google.gms.google-services'
apply plugin: 'kotlin-android'
apply plugin: 'kotlin-kapt'
android {
compileSdkVersion 32
defaultConfig {
applicationId "co.xyz.abc"
minSdkVersion 21
targetSdkVersion 32
versionCode 15
versionName "1.1.1"
multiDexEnabled true
renderscriptTargetApi 19
renderscriptSupportModeEnabled true
vectorDrawables.useSupportLibrary = true
}
buildTypes {
// ...
}
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
kotlinOptions {
jvmTarget = '1.8'
}
buildFeatures {
viewBinding true
}
}
dependencies {
// AndroidX
// ....
//kotlin
implementation 'org.jetbrains.kotlin:kotlin-stdlib:1.7.10'
implementation 'androidx.core:core-ktx:1.9.0'
// ViewModel
def lifecycle_version = "2.4.1"
implementation "androidx.lifecycle:lifecycle-viewmodel-ktx:$lifecycle_version"
// Dagger2
def daggerVersion = "2.35.1"
api "com.google.dagger:dagger:$daggerVersion"
annotationProcessor "com.google.dagger:dagger-compiler:$daggerVersion"
// Dagger Android
api "com.google.dagger:dagger-android-support:$daggerVersion"
api "com.google.dagger:dagger-android:$daggerVersion"
annotationProcessor "com.google.dagger:dagger-android-processor:$daggerVersion"
// AssistedInject
def assistedInject = '0.6.0'
compileOnly "com.squareup.inject:assisted-inject-annotations-dagger2:$assistedInject"
annotationProcessor "com.squareup.inject:assisted-inject-processor-dagger2:$assistedInject"
androidTestImplementation 'junit:junit:4.13.2'
}
gradle.properties
android.enableJetifier=true
android.useAndroidX=true
org.gradle.jvmargs=-Xmx1536m
kotlin.code.style=official
gradle-wrapper.properties
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-7.3.3-all.zip
Errors after Rebuild:
FAILURE: Build failed with an exception.
What went wrong: Execution failed for task ':app:checkStagingLocalDevAarMetadata'. A failure occurred while
executing
com.android.build.gradle.internal.tasks.CheckAarMetadataWorkAction
3 issues were found when checking AAR metadata:
Dependency 'androidx.core:core-ktx:1.9.0' requires libraries and applications that
depend on it to compile against version 33 or later of the
Android APIs.
:app is currently compiled against android-32.
Also, the maximum recommended compile SDK version for Android Gradle
plugin 7.2.1 is 32.
Recommended action: Update this project's version of the Android Gradle
plugin to one that supports 33, then update this project to use
compileSdkVerion of at least 33.
Note that updating a library or application's compileSdkVersion (which
allows newer APIs to be used) can be done separately from updating
targetSdkVersion (which opts the app in to new runtime behavior) and
minSdkVersion (which determines which devices the app can be installed
on).
Dependency 'androidx.core:core:1.9.0' requires libraries and applications that
depend on it to compile against version 33 or later of the
Android APIs.
:app is currently compiled against android-32.
Also, the maximum recommended compile SDK version for Android Gradle
plugin 7.2.1 is 32.
Recommended action: Update this project's version of the Android Gradle
plugin to one that supports 33, then update this project to use
compileSdkVerion of at least 33.
Note that updating a library or application's compileSdkVersion (which
allows newer APIs to be used) can be done separately from updating
targetSdkVersion (which opts the app in to new runtime behavior) and
minSdkVersion (which determines which devices the app can be installed
on).
Dependency 'androidx.annotation:annotation-experimental:1.3.0' requires libraries and applications that
depend on it to compile against version 33 or later of the
Android APIs.
:app is currently compiled against android-32.
Also, the maximum recommended compile SDK version for Android Gradle
plugin 7.2.1 is 32.
Recommended action: Update this project's version of the Android Gradle
plugin to one that supports 33, then update this project to use
compileSdkVerion of at least 33.
Note that updating a library or application's compileSdkVersion (which
allows newer APIs to be used) can be done separately from updating
targetSdkVersion (which opts the app in to new runtime behavior) and
minSdkVersion (which determines which devices the app can be installed
on).
When I change compileSdk to 33 :
Task :app:compileStagingLocalDevJavaWithJavac
error: cannot find symbol import
co.abc.client.di.components.DaggerABCApplicationComponent;
^ symbol: class DaggerABCApplicationComponent location: package
co.abc.client.di.components
Now, if I downgrade the core-ktx version to 1.8.0 and change annotationProcessor to kapt :
Task :app:kaptStagingLocalDevKotlin
/StudioProjects/project/app/src/main/java/co/abc/client/di/modules/account/AssistedModule.java:8:
error: cannot find symbol #Module(includes =
AssistedInject_AssistedModule.class)
^ symbol: class AssistedInject_AssistedModule /StudioProjects/project/app/src/main/java/co/abc/client/di/modules/account/AssistedModule.java:9:
error: [ComponentProcessor:MiscError]
dagger.internal.codegen.ComponentProcessor was unable to process this
interface because not all of its dependencies could be resolved. Check
for compilation errors or a circular dependency with generated code.
public interface AssistedModule {}
^ /StudioProjects/project/app/src/main/java/co/abc/client/di/components/ABCApplicationComponent.java:40:
error: [ComponentProcessor:MiscError]
dagger.internal.codegen.ComponentProcessor was unable to process this
interface because not all of its dependencies could be resolved. Check
for compilation errors or a circular dependency with generated code.
public interface ABCApplicationComponent extends
AndroidInjector {
^
Task :app:kaptStagingLocalDevKotlin FAILED
FAILURE: Build failed with an exception.
What went wrong: Execution failed for task ':app:kaptStagingLocalDevKotlin'. A failure occurred while executing
org.jetbrains.kotlin.gradle.internal.KaptWithoutKotlincTask$KaptExecutionWorkAction
java.lang.reflect.InvocationTargetException (no error message)
What could be the issue here? Should the Dagger-related code be written in Kotlin? Is there a source I could refer to for kotlin integration in java code base for android when dagger is there?
So far, I have tried these which didn't work:
upgrading and downgrading versions for kotlin and dagger.
changing all annotationProcessors to kapt
adding this to gradle - -Pandroid.incrementalJavaCompile=false
android {
compileOptions.incremental = false
}
restart ide
Also, I have another project(java code base and kotlin integration setup) which is working with these versions so the issue doesn't seem to be with that. only difference is, dagger is not in my other project and everything runs fine there.
try using the latest version of the dagger in both Gradle
//Hilt
implementation 'com.google.dagger:hilt-android:2.42'
kapt 'com.google.dagger:hilt-android-compiler:2.42'
kapt "androidx.hilt:hilt-compiler:1.0.0"
in App level
classpath 'com.google.dagger:hilt-android-gradle-plugin:2.42'
Maybe it is a version issue
downgrade your kotlin version and then check it
implementation 'org.jetbrains.kotlin:kotlin-stdlib:1.5.30'
implementation 'androidx.core:core-ktx:1.8.0'
I am working on this project: https://github.com/muxinc/mux-stats-sdk-exoplayer/tree/min_sdk_version_fix It is Android app called demo that have dependency to a module from a same project called MuxExoPlayer which have a dependency to a MuxCore.jar library.
When I try to compile the project with minSdkVersion 16, I get desugaring issue on jar file, error:
Transform artifact full.jar (project :MuxExoPlayer) with DexingWithClasspathTransform
AGPBI: {"kind":"error","text":"Default method desugaring of `com.mux.stats.sdk.muxstats.MuxStatsExoPlayer` failed because it's hierarchy is incomplete. The class `com.mux.stats.sdk.core.events.EventBus` is missing and it is the declared super class of `com.mux.stats.sdk.muxstats.MuxBaseExoPlayer`","sources":[{}],"tool":"D8"}
When I compile with minSdkVersion 24, I do not get this error and project compile just fine.
MuxCore.jar is also built with gradle, here is the gradle.build:
apply plugin: 'java-library'
// In this section you declare where to find the dependencies of your project
repositories {
// Use jcenter for resolving your dependencies.
// You can declare any Maven/Ivy/file repository here.
jcenter()
}
tasks.withType(JavaCompile) {
sourceCompatibility = '1.7'
targetCompatibility = '1.7'
}
dependencies {
// This dependency is exported to consumers, that is to say found on their compile classpath.
api 'org.apache.commons:commons-math3:3.6.1'
// This dependency is used internally, and not exposed to consumers on their own compile classpath.
implementation 'com.google.guava:guava:23.0'
implementation 'org.json:json:20180130'
// Use JUnit test framework
testImplementation 'junit:junit:4.4'
testImplementation 'org.mockito:mockito-core:2.23.4'
}
What am I missing here ?
How do I need to compile MuxCore in order to compile with android minSdkVersion 16 ?
I have the same problem and also create a ticket in Mux github repo but could not make it work... If you update the minSdk to 24 it will work...
https://github.com/muxinc/mux-stats-sdk-exoplayer/issues/19
What is working for me is: instead of adding MuxStatsExoPlayer as a module add directly all the files and classes in your app module into your project and it should work.
I am using Android Studio version
Android Studio 3.2 Canary 14
Build #AI-181.4668.68.32.4763614, built on May 4, 2018
JRE: 1.8.0_152-release-1136-b02 x86_64
JVM: OpenJDK 64-Bit Server VM by JetBrains s.r.o
Mac OS X 10.11.6
While investigating the new Architectural navigation components android.arch.navigation I have encountered this build failure.
AGPBI: {"kind":"error","text":"Program type already present: android.support.v4.os.ResultReceiver$1","sources":[{}],"tool":"D8"}
:app:transformDexArchiveWithExternalLibsDexMergerForDebug FAILED
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':app:transformDexArchiveWithExternalLibsDexMergerForDebug'.
> com.android.builder.dexing.DexArchiveMergerException: Error while merging dex archives: ...
...
Program type already present: android.support.v4.os.ResultReceiver$1
My app gradle build resembles:-
apply plugin: 'com.android.application'
apply plugin: "androidx.navigation.safeargs"
android {
compileSdkVersion 'android-P'
defaultConfig {
applicationId "com.research.frager"
minSdkVersion 19
targetSdkVersion 28
versionCode 1
versionName "1.0"
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
def nav_version = "1.0.0-alpha01"
implementation "android.arch.navigation:navigation-fragment:$nav_version"
implementation "android.arch.navigation:navigation-ui:$nav_version"
// optional - Test helpers
androidTestImplementation "android.arch.navigation:navigation-testing:$nav_version"
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation 'androidx.appcompat:appcompat:1.0.0-alpha1'
implementation 'androidx.constraintlayout:constraintlayout:1.1.0'
implementation 'androidx.lifecycle:lifecycle-extensions:2.0.0-alpha1'
testImplementation 'junit:junit:4.12'
androidTestImplementation 'androidx.test:runner:1.1.0-alpha2'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.1.0-alpha2'
}
and project level gradle build:-
buildscript {
repositories {
google()
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.2.0-alpha14'
classpath "android.arch.navigation:navigation-safe-args-gradle-plugin:1.0.0-alpha01"
}
}
allprojects {
repositories {
google()
jcenter()
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}
I have tried refactoring to AndroidX, however I get a message stating No usages found in project, so why is this "v4" class still being mentioned?
I've been looking at this issue and I have sorted the main issue here by excluding the support package when adding the dependency to the library, doing this:
implementation("android.arch.navigation:navigation-fragment:$nav_version") {
exclude group: 'com.android.support'
}
That would allow you to run the application. However, this artifact is using the support artifacts rather than the androidx artifacts. Looking at the documentation, we can see that NavHostFragment is extending support.v4.Fragment
https://developer.android.com/reference/androidx/navigation/fragment/NavHostFragment
So, in short, you are presented with three options, as far as I can see. The first one is to drop the androidx artifacts and use the support ones which eventually depends on how big your app is.
The second option is to drop the navigation library and go back to the classic way of dealing with navigation which, I guess, is probably undesirable for you.
The third option is to implement a navigation host of your own which I don't know how much work it would be.
This response will remain accurate until Google releases the androidx version of the library which I am surprised they haven't already.
Hope that was helpful.
I just clones an android project from my local repo and I have trouble to 'build' it. Maybe it missed some external library, but I do not know.
Upon starting a grade build I get the following message:
Error:A problem occurred configuring project ':app'.
> Could not resolve all dependencies for configuration ':app:_debugApk'.
> Configuration with name 'default' not found.
I tried to check the 'Manifest' file, but I can't find it. I am completely lost...
I am pretty sure this is a configuration error, therefore all the config files I can find here:
build.gradle (project)
buildscript {
repositories {
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:2.2.3'
classpath 'com.google.gms:google-services:3.0.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
}
build.gradle (app)
apply plugin: 'com.android.application'
android {
compileSdkVersion 23
buildToolsVersion "23.0.1"
defaultConfig {
applicationId "com.impyiablue.myapp"
minSdkVersion 16
targetSdkVersion 23
versionCode 1
versionName "1.0"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
dexOptions {
preDexLibraries = false
}
}
repositories {
mavenCentral()
}
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
testCompile 'junit:junit:4.12'
compile 'com.android.support:appcompat-v7:23.4.0'
compile 'com.android.support:design:23.1.0'
compile 'com.mcxiaoke.volley:library:1.0.19'
compile 'com.google.firebase:firebase-ads:9.0.0'
compile 'in.srain.cube:grid-view-with-header-footer:1.0.12'
compile 'com.github.paolorotolo:appintro:4.1.0'
compile project(path: ':LibraryModule')
}
apply plugin: 'com.google.gms.google-services'
cradle-wrapper.properties
#Wed Sep 07 20:03:05 CEST 2016
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-2.14.1-all.zip
settings.gradle:
include ':app'
include ':libraries:volley'
include ':LibraryModule'
project(':LibraryModule').projectDir = new File('/Users/adietz/AndroidStudioProjects/LIBS')
local.properties:
## This file is automatically generated by Android Studio.
# Do not modify this file -- YOUR CHANGES WILL BE ERASED!
#
# This file must *NOT* be checked into Version Control Systems,
# as it contains information specific to your local configuration.
#
# Location of the SDK. This is only used by Gradle.
# For customization when using a Version Control System, please read the
# header note.
#Sun Oct 15 11:07:25 CEST 2017
sdk.dir=/Users/adietz/Library/Android/sdk
The output of ./gradlew build (from inside the project folder) is the following:
WARNING: An illegal reflective access operation has occurred
WARNING: Illegal reflective access by org.gradle.internal.reflect.JavaMethod (file:/Users/adietz/.gradle/wrapper/dists/gradle-2.14.1-all/4cj8p00t3e5ni9e8iofg8ghvk7/gradle-2.14.1/lib/gradle-base-services-2.14.1.jar) to method java.lang.ClassLoader.getPackages()
WARNING: Please consider reporting this to the maintainers of org.gradle.internal.reflect.JavaMethod
WARNING: Use --illegal-access=warn to enable warnings of further illegal reflective access operations
WARNING: All illegal access operations will be denied in a future release
FAILURE: Build failed with an exception.
* What went wrong:
A problem occurred configuring project ':app'.
> Failed to notify project evaluation listener.
> javax/xml/bind/annotation/XmlSchema
* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.
BUILD FAILED
Total time: 7.217 secs
Part of the solution seems to be a change in the file build.gradle (for Module:app). If you replace this line
compile project(path: ':LibraryModule')
with this line:
compile project(':libraries:volley')
and do 'Clean Project again', different things might happen:
AndroidStudio start to download stuff
Other gradle files appear mysteriously in your Gradle Scripts folder
Other errors appear (which you can google and actually find some helpful answers)
But it might fix the actual problem...
Hi Im new to swagger and It was a while since I developed for Android - haven't understood all with the gradle files etc.
Im stuck with this problem with dependency to the JUnit 4.12
I have a project that I wan't to merge with a project created with a project generated with swagger-codegen
I have imported the source but now I'm stuck with getting to resolve Junit:2.14
Failed to resolve: junit:junit:4.12
I have tried to add it to gradlebuild diffrent ways and read some where that you sould add maven as repositiory. Have imported the pom.xml.
In the swagger-codegen project there's a file called build.sbt thats not in my project. Does it have anything to do with that file? Don't really understand why there should be yet another build file.
apply plugin: 'com.android.application'
android {
compileSdkVersion 23
buildToolsVersion "24.0.0"
defaultConfig {
applicationId "com.xxxxx.app.xxxxx"
minSdkVersion 15
targetSdkVersion 23
versionCode 1
versionName "1.0"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
buildscript {
repositories {
jcenter()
maven { url 'http://repo1.maven.org/maven2' }
}
dependencies {
classpath 'com.android.tools.build:gradle:1.2.3'
}
}
dependencies {
compile fileTree(include: ['*.jar'], dir: 'libs')
compile 'com.google.android.gms:play-services-gcm:7.8.0'
compile 'com.android.support:appcompat-v7:23.4.0'
compile 'com.android.support:design:23.4.0'
androidTestCompile 'junit:junit:4.12'
}
Please use Swagger Codegen 2.2.0 (recently released) to generate the Android API client if you've not done so as the latest stable version generates Android API client with the Volley library (instead of HttpClient) by default (Android API client with HttpClient is no longer actively maintained).
You may also find this FAQ useful: https://github.com/swagger-api/swagger-codegen/wiki/FAQ#how-can-i-generate-an-android-sdk
About your question on the build.sbt file, that's used by another build tool called sbt, mainly used by Scala.
Do you even need junit?
If so, then I think the correct line of Gradle is this (drop the android piece of the compile)
testCompile 'junit:junit:4.12'
You have the repositories block for the buildscript but you need one for the dependencies:
repositories {
mavenCentral()
}
Junit 4.12 is hosted on MavenCentral here: https://mvnrepository.com/artifact/junit/junit.