pytorch
6edd49a8 - [Android]Removed dependency with AppCompat. (#58527)

Commit
3 years ago
[Android]Removed dependency with AppCompat. (#58527) Summary: I build using [Bazel](https://bazel.build/). When I use `pytorch_android` in latest Android app, I get the following error due to dependencies: ``` $ bazel build //app/src/main:app WARNING: API level 30 specified by android_ndk_repository 'androidndk' is not available. Using latest known API level 29 INFO: Analyzed target //app/src/main:app (0 packages loaded, 0 targets configured). INFO: Found 1 target... ERROR: /home/H1Gdev/android-bazel-app/app/src/main/BUILD.bazel:3:15: Merging manifest for //app/src/main:app failed: (Exit 1): ResourceProcessorBusyBox failed: error executing command bazel-out/k8-opt-exec-2B5CBBC6/bin/external/bazel_tools/src/tools/android/java/com/google/devtools/build/android/ResourceProcessorBusyBox --tool MERGE_MANIFEST -- --manifest ... (remaining 11 argument(s) skipped) Use --sandbox_debug to see verbose messages from the sandbox ResourceProcessorBusyBox failed: error executing command bazel-out/k8-opt-exec-2B5CBBC6/bin/external/bazel_tools/src/tools/android/java/com/google/devtools/build/android/ResourceProcessorBusyBox --tool MERGE_MANIFEST -- --manifest ... (remaining 11 argument(s) skipped) Use --sandbox_debug to see verbose messages from the sandbox Error: /home/H1Gdev/.cache/bazel/_bazel_H1Gdev/29e18157a4334967491de4cc9a879dc0/sandbox/linux-sandbox/914/execroot/__main__/app/src/main/AndroidManifest.xml:19:18-86 Error: Attribute application@appComponentFactory value=(androidx.core.app.CoreComponentFactory) from [maven//:androidx_core_core] AndroidManifest.xml:19:18-86 is also present at [maven//:com_android_support_support_compat] AndroidManifest.xml:19:18-91 value=(android.support.v4.app.CoreComponentFactory). Suggestion: add 'tools:replace="android:appComponentFactory"' to <application> element at AndroidManifest.xml:5:5-19:19 to override. May 19, 2021 10:45:03 AM com.google.devtools.build.android.ManifestMergerAction main SEVERE: Error during merging manifests com.google.devtools.build.android.AndroidManifestProcessor$ManifestProcessingException: Manifest merger failed : Attribute application@appComponentFactory value=(androidx.core.app.CoreComponentFactory) from [maven//:androidx_core_core] AndroidManifest.xml:19:18-86 is also present at [maven//:com_android_support_support_compat] AndroidManifest.xml:19:18-91 value=(android.support.v4.app.CoreComponentFactory). Suggestion: add 'tools:replace="android:appComponentFactory"' to <application> element at AndroidManifest.xml:5:5-19:19 to override. at com.google.devtools.build.android.AndroidManifestProcessor.mergeManifest(AndroidManifestProcessor.java:186) at com.google.devtools.build.android.ManifestMergerAction.main(ManifestMergerAction.java:217) at com.google.devtools.build.android.ResourceProcessorBusyBox$Tool$5.call(ResourceProcessorBusyBox.java:93) at com.google.devtools.build.android.ResourceProcessorBusyBox.processRequest(ResourceProcessorBusyBox.java:233) at com.google.devtools.build.android.ResourceProcessorBusyBox.main(ResourceProcessorBusyBox.java:177) Warning: See http://g.co/androidstudio/manifest-merger for more information about the manifest merger. Target //app/src/main:app failed to build Use --verbose_failures to see the command lines of failed build steps. INFO: Elapsed time: 2.221s, Critical Path: 1.79s INFO: 2 processes: 2 internal. FAILED: Build did NOT complete successfully ``` This is due to conflict between `AndroidX` and `Support Library` on which `pytorch_android_torch` depends. (In the case of `Gradle`, it is avoided by `android.useAndroidX`.) I created [Android application](https://github.com/H1Gdev/android-bazel-app) for comparison. At first, I updated `AppCompat` from `Support Library` to `AndroidX`, but `pytorch_android` and `pytorch_android_torchvision` didn't seem to need any dependencies, so I removed dependencies. Pull Request resolved: https://github.com/pytorch/pytorch/pull/58527 Reviewed By: xta0 Differential Revision: D28585234 Pulled By: IvanKobzarev fbshipit-source-id: 78aa6b1525543594ae951a6234dd88a3fdbfc062
Author
Parents
Loading