I have literally created a brand new Android Project on the latest Android Studio. The first thing I did was to add the `Realm' library to the project by adding the following to the gradle file:
compile 'io.realm:realm-android:0.80.3'
If I try to compile, I get the following error:
Note: C:\....\MainActivity.java uses or overrides a deprecated API.
Origin 2: C:\Users\Usmaan.gradle\caches\modules-2\files-2.1\io.realm\realm-android\0.80.3\7979d05ba7b919c53766bf98e31aaf0e9feb0590\realm-android-0.80.3.jar Error:duplicate files during packaging of APK C:...\app\build\outputs\apk\app-debug-unaligned.apk Path in archive: META-INF/services/javax.annotation.processing.Processor Origin 1: C:\Users\Usmaan.gradle\caches\modules-2\files-2.1\com.jakewharton\butterknife\6.1.0\63735f48b82bcd24cdd33821342428252eb1ca5a\butterknife-6.1.0.jar You can ignore those files in your build.gradle: android {
packagingOptions { exclude 'META-INF/services/javax.annotation.processing.Processor' } Error:Execution failed for task ':app:packageDebug'.Duplicate files copied in APK META-INF/services/javax.annotation.processing.Processor File 1: C:\Users\Usmaan.gradle\caches\modules-2\files-2.1\com.jakewharton\butterknife\6.1.0\63735f48b82bcd24cdd33821342428252eb1ca5a\butterknife-6.1.0.jar File 2: C:\Users\Usmaan.gradle\caches\modules-2\files-2.1\io.realm\realm-android\0.80.3\7979d05ba7b919c53766bf98e31aaf0e9feb0590\realm-android-0.80.3.jar }
Any ideas?
You can resolve this warning message by using recommned API. In our example, we should use setVisible(true) rather than show() method. When you will compile above code, you won't get warning message anymore. That's all about how to fix uses or overrides a deprecated api.
What happens if i continue using Deprecated methods? Code would continue running as it is until method is removed from SDK. If you are using deprecated method then you must keep track of removed apis whenever you upgrade to newest SDK. If you don't want a change at all then check for the reason behind deprecation.
Deprecation means that we've ended official support for the APIs, but they will continue to remain available to developers. This page highlights some of the deprecations in this release of Android. To see other deprecations, refer to the API diff report.
Android Studio created an activity for us called MainActivity. java. The activity specifies what the app does and how it should respond to the user.
It looks like you are also using Butterknife? Have you tried adding the below to your build.gradle:
android {
...
packagingOptions {
exclude 'META-INF/services/javax.annotation.processing.Processor'
}
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With