I am having issues compiling and running my application on Android Studio.
The problem: It doesn't like that I am using deprecated APIs. (from gradlew compileDebug --stacktrace. Full stacktrace here
Note: Some input files use or override a deprecated API.
Note: Recompile with -Xlint:deprecation for details.
The Background:
I am using a PreferenceActivity which uses onPreferenceTreeClick and addPreferencesFromResource(int), both deprecated methods.
I am using ABS and ViewPager libraries, which both seem to also be using deprecated methods in their code.
The Question:
Can the run configurations be edited to an extend where It can compile succesfully despite of the deprecated APIs?
What can be changed/edited/modified to allow the build to compile succesfully?
Given that I plan on supporting pre-ICS devices and the usage of deprecated APIS shoudln't suppose a problem.
EDIT
So, the compiler from command prompt indicates the build was succesful, problem is running from Android Studio directly, the build process fails:
FAILURE: Build failed with an exception.
The problem seems to be something I have no idea how to fix, the popular line is:
UNEXPECTED TOP-LEVEL EXCEPTION:
java.lang.IllegalArgumentException: already added:
which is happening at three different places:
Landroid/support/v4/accessibilityservice/AccessibilityServiceInfoCompat$AccessibilityServiceInfoStubImpl;
Landroid/support/v4/app/ActivityCompatHoneycomb;
Landroid/support/v4/app/LoaderManager;
Here's some more info: Full Compiler output in Android Studio
* What went wrong:
Execution failed for task ':LaPrensa:dexDebug'.
> Running C:\Users\SkullKandy\AppData\Local\Android\android-studio\sdk\build-tools\android-4.2.2\dx.bat failed.
You have simply to add this code to build.gradle (in android section)
lintOptions {
abortOnError false
}
Related
I am using Android Studio BumbleBee 2021.1.1 RC 1
I Got this Error while I am running my project
(other project not showing any error like this.)
SCREEN SHOT :
Error : Android Manifest doesn't exists or has incorrect root tag
I had tried all the solutions , comment given in this link but not fixed :
(tried almost all solution in stack over flow)
Solution 1
Solution 2
Solution 3
--------------Solution That I tried---------------------
Sync project with Gradle files
Invalidate Caches and Restart....
Delete .gradle/.idea/ folder
Clean Project & Re-Build
Re-Created a new project and move all files to their. (tried as in case if manifest file corrupted)
Downgraded target sdk version to 30.
Upgrading/Downgrading Gradle version.
In AS terminal run
./gradlew clean assembleDebug (but still not fixed.)
I am attaching stacktrace by running ./gradlew build --stacktrace (which gives error details)
Task :app:compileReleaseJavaWithJavac Note: Some input files use or override a deprecated API. Note: Recompile with -Xlint:deprecation for
details.
Task :app:minifyReleaseWithR8 AGPBI: {"kind":"warning","text":"Missing classes detected while running R8.
Please add the missing classes or apply additional keep rules that are
generated in D:\Android Project\DigiSchool BackUp\PlayStore\12 Aug
2021\EvvStudy\digi-schoo\app\build\outputs\mapping\release\missing_rules.txt.\n","sources":[{}]}
AGPBI: {"kind":"warning","text":"Missing class
kotlinx.coroutines.CoroutineScope (referenced from:
kotlinx.coroutines.CoroutineScope
id.zelory.compressor.Compressor$compress$3.p$ and 1 other
context)","sources":[{}],"tool":"R8"}
Task :app:lintDebug Wrote HTML report to file:///D:/Android%20Project/DigiSchool%20BackUp/PlayStore/12%20Aug%202021/EvvStudy/digi-schoo/app/build/reports/lint-results-debug.html
Deprecated Gradle features were used in this build, making it
incompatible with Gradle 8.0. Use '--warning-mode all' to show the
individual deprecation warnings. See
https://docs.gradle.org/7.0.2/userguide/command_line_interface.html#sec:command_line_warnings
Still facing that issue please help me in to this.
I found the answer right now since I was facing the same issue without founding any solution.
On Android Studio go to:
File -> Project Structure (Ctrl+Alt+Maiusc+S) -> Facets -> Structure -> Manifest file:
Change the path of the file, the path is under
YOURAPPNAME\android\app\src\main
I had to integrate a library into my app and the library had its gradle version as 4.0.0, while my app had 3.2.2 (or something). So it bumped into the queries tag in the library (in its Manifest) that it wouldn’t recognize. Therefore I have updated the gradle version in my app to be the same as the library, at 4.0.0 (now I put it as 4.1.0, the latest).
The problem is that I bump into the following error:
`Execution failed for task ‘:app:processCanaryDebugManifest’.
Could not get unknown property ‘manifestOutputDirectory’ for task ‘:app:processCanaryDebugManifest’ of type com.android.build.gradle.tasks.ProcessMultiApkApplicationManifest.
This is based on this warning:
API 'variantOutput.getProcessManifest()' is obsolete and has been replaced with 'variantOutput.getProcessManifestProvider()'.
I haven’t been able to make any progress on this. I have ran the gradlew command with --stacktrace but all I get are errors from gradle, nothing specific. Do you know of any way to make this work? The only things I've found so far are issues with a Huawei thing, but it's not the case for me. Thanks!
PS. I'm not sure what additional info would be useful in this circumstance.
EDIT: I've downgraded to gradle 3.3.3 and commented out my new library dependecies, and now it says:
`Execution failed for task ':app:processCanaryDebugManifest'.
java.io.FileNotFoundException: property(interface org.gradle.api.file.Directory, transform(property(interface org.gradle.api.file.Directory, fixed(class org.gradle.api.internal.file.DefaultProjectLayout$FixedDirectory, C:\build\myapp\app))))\AndroidManifest.xml (The filename, directory name, or volume label syntax is incorrect)`
Ok so I believe I followed these instructions perfectly: https://rnfirebase.io/docs/v5.x.x/installation/android
1) After completing the instructions I get this error: Minimum supported Gradle version is 4.6. Current version is 4.4.
2) I go into gradle-wrapper.properties and change distributionUrl from
https\://services.gradle.org/distributions/gradle-4.4-all.zip
to
https\://services.gradle.org/distributions/gradle-4.6-all.zip
and re-synce
3) When I try to build after this I get the error:
org.gradle.api.tasks.TaskExecutionException: Execution failed for task ':app:mergeDevMinSdkDevKernelDebugResources'.
In the Java compiler I get the error:
/Users/DJarrin/Work/dev_envs/****/node_modules/react-native-device-info/android/src/main/java/com/learnium/RNDeviceInfo/RNDeviceModule.java:
uses or overrides a deprecated API.
Recompile with -Xlint:deprecation for details.
I'm pretty lost and would really appreciate just some next steps to solve the issue.
I've inherited a cordova project that uses cordova-plugin-xapkreader, which appears to be the standard plugin for accessing expansion (aka OBB) files. I'm encountering an issue with it that I would expect to affect other cordova plugins. I get the following errors when running cordova build android:
Configuration 'compile' in project ':' is deprecated. Use 'implementation' instead.
publishNonDefault is deprecated and has no effect anymore. All variants are now published.
Configuration 'compile' in project ':com.flyingsoftgames.xapkreader:downloader_library' is deprecated. Use 'implementation' instead.
publishNonDefault is deprecated and has no effect anymore. All variants are now published.
Configuration 'debugCompile' in project ':com.flyingsoftgames.xapkreader:downloader_library' is deprecated. Use 'debugImplementation' instead.
Configuration 'releaseCompile' in project ':com.flyingsoftgames.xapkreader:downloader_library' is deprecated. Use 'releaseImplementation' instead.
Configuration 'compile' in project ':com.flyingsoftgames.xapkreader:library' is deprecated. Use 'implementation' instead.
FAILURE: Build failed with an exception.
* What went wrong:
Could not determine the dependencies of task ':compileDebugJavaWithJavac'.
> Could not resolve all task dependencies for configuration ':debugCompileClasspath'.
> Could not resolve project :com.flyingsoftgames.xapkreader:library.
Required by:
project : > project :com.flyingsoftgames.xapkreader:downloader_library
> Project :com.flyingsoftgames.xapkreader:downloader_library declares a dependency from configuration 'debugCompile' to configuration 'debug' which is not declared in the descriptor for project :com.flyingsoftgames.xapkreader:library.
This has been reported as a bug on the plugin's forum by someone else, but the workaround doesn't reliable work:
https://github.com/agamemnus/cordova-plugin-xapkreader/issues/116
The issue appears to be that gradle expects you to now use implementation rather than compile, debugCompile etc. The gradle file for the plugin is generated by cordova, based on a template inside cordova-android. The suggested workaround is to modify the template (or the generated gradle files) in a script run from a cordova hook. Unfortunately for some reason, the hooks don't appear to work reliably - sometimes they do, sometimes they don't. This feels like it may be due to a race condition caused by the hooks running asynchronously with the rest of the build process - so sometimes the gradle build has started before the gradle files can be modified.
Does any have any ideas how to properly fix this? Does anyone know why this isn't a more wide-spread issue that the cordova-android project hasn't fixed by modifying their template? Is this something I can fix by downgrading some part of the build process?
I'm pretty new to Cordova, so it's all quite baffling and any help is much appreciated!
Unfortunately for some reason, the hooks don't appear to work reliably
- sometimes they do, sometimes they don't. This feels like it may be due to a race condition caused by the hooks running asynchronously
with the rest of the build process - so sometimes the gradle build has
started before the gradle files can be modified.
I think this can be fixed by making the hook return a promise, this way you can ensure the rest of the build won't run in parallel. I posted the code I'm using on the github issue.
The revelant code is the following:
- create a promise at the beginning of the hook:
const deferral = context.requireCordovaModule('q').defer();
- return the promise at the end of the hook:
return deferral.promise;
- resolve the promise once the work is finished (the file is written):
deferral.resolve();
I'm working on an Android project with two projects inside it. When trying to run a build with gradlew (./gradlew build), I see the following error:
Execution failed for task ':example:lint'.
Could not initialize class
com.android.build.gradle.tasks.Lint$LintGradleIssueRegistry
With stacktrace enabled, this is listed as a java.lang.NoClassDefFoundError.
Oddly, the first time I ran this (which downloaded dependencies), the build failed with a different error:
Execution failed for task ':example:lint'.
lombok/ast/Node
The gradle wrapper that Android SDK created for the project is using Gradle 2.8.
Could this be a configuration issue with the project or my dev machine? I'm trying to avoid using the Android SDK lint tool as this complains about the projects using Gradle (and I hear it may miss some parts of these projects).
Turned out this was a configuration issue in our build.gradle. The following line had been added for testing and never removed:
configurations.classpath.exclude group: 'com.android.tools.external.lombok'
As such, the classes needed for linting were missing.
The following discussion pointed us in the right direction, in case it's useful to anyone else:
https://github.com/evant/gradle-retrolambda/issues/96