I have been working on an application for android that utilizes the android comparability library (android-support-v4). Before SDK 20, I was able to compile my application with the following uses-sdk
entry in my manifest.
<uses-sdk android:minSdkVersion="7" />
All my fragments that started an activity for result received their results properly.
One day (Before I updated to SDK 20) I was fixing lint issues, and I added android:targetSdkVersion
to the manifest per the lint flag's request, and I soon realized that none of my fragments were receiving their onActivityResilt() calls.
Now every since I have updated to SDK 20.0.1, I am forced to utilize the android:targetSdkVersion
in uses-sdk
entry in my manifest; otherwise R.java is never generated.
Here is my current uses-sdk
manifest entry
<uses-sdk
android:minSdkVersion="7"
android:targetSdkVersion="16" />
Currently because of this odd bug, my application is currently still broken. I have tryied updating my compatibly library the the latest version r9.
Also I have double checked all my startActivityForResult()
calls in the fragments. They all use the proper calls through the fragment's method.
i.e.
this.startActivityForResult(intent, requestCode);
not
this.getActivity().startActivityForResult(intent, requestCode);
My current Development Environment:
Android SDK 20.0.1
Android SDK Platform Tools 13
ADT 20.0.2
Any help would be greatly appreciated, as this bug is currently the brick wall that is preventing my final beta tests.
EDIT
Here's my output of ant debug
$ ant debug Buildfile: /home/ricky/Development/workspace/location_ringer/LocationRinger/build.xml
-set-mode-check:
-set-debug-files:
-check-env: [checkenv] Android SDK Tools Revision 20.0.1 [checkenv] Installed at /app/android-sdk-linux_86
-setup: [echo] Project Name: ListActivity [gettype] Project Type: Application
-set-debug-mode:
-debug-obfuscation-check:
-build-setup: [echo] Resolving Build Target for ListActivity... [gettarget] Project Target: Google APIs [gettarget] Vendor: Google Inc. [gettarget] Platform Version: 4.1 [gettarget] API level:
16 [echo] ---------- [echo] Creating output directories if needed... [echo] ---------- [echo] Resolving Dependencies for ListActivity... [dependency] Library dependencies: [dependency] [dependency] ------------------ [dependency] Ordered libraries: [dependency] [dependency] ------------------ [dependency] API<=15: Adding annotations.jar to the classpath. [echo] ---------- [echo] Building Libraries with 'debug'...nodeps:
-set-mode-check:
-set-debug-files:
-check-env: [checkenv] Android SDK Tools Revision 20.0.1 [checkenv] Installed at /app/android-sdk-linux_86
-setup: [echo] Project Name: LocationLib [gettype] Project Type: Android Library
-set-debug-mode:
-debug-obfuscation-check:
-build-setup: [echo] Resolving Build Target for LocationLib... [gettarget] Project Target: Google APIs [gettarget] Vendor: Google Inc. [gettarget] Platform Version: 4.1 [gettarget] API level:
16 [echo] ---------- [echo] Creating output directories if needed... [echo] ---------- [echo] Resolving Dependencies for LocationLib... [dependency] Library dependencies: [dependency] No Libraries [dependency] [dependency] ------------------ [dependency] API<=15: Adding annotations.jar to the classpath.-pre-build:
-code-gen: [mergemanifest] No changes in the AndroidManifest files. [echo] Handling aidl files... [aidl] No AIDL files to compile. [echo] ---------- [echo] Handling RenderScript files... [renderscript] No RenderScript files to compile. [echo] ---------- [echo] Handling Resources... [aapt] No changed resources. R.java and Manifest.java untouched. [echo] ---------- [echo] Handling BuildConfig class... [buildconfig] No need to generate new BuildConfig.
-pre-compile:
-compile: [echo] Creating library output jar file...
-post-compile:
-obfuscate:
-dex: [echo] Library project: do not convert bytecode...
-crunch: [crunch] Crunching PNG Files in source dir: /home/ricky/Development/workspace/location_library/LocationLib/res
[crunch] To destination dir: /home/ricky/Development/workspace/location_library/LocationLib/bin/res [crunch] Crunched 0 PNG files to update cache-package-resources: [echo] Library project: do not package resources...
-package: [echo] Library project: do not package apk...
-post-package:
-do-debug: [echo] Library project: do not create apk... [propertyfile] Updating property file: /home/ricky/Development/workspace/location_library/LocationLib/bin/build.prop [propertyfile] Updating property file: /home/ricky/Development/workspace/location_library/LocationLib/bin/build.prop [propertyfile] Updating property file: /home/ricky/Development/workspace/location_library/LocationLib/bin/build.prop [propertyfile] Updating property file: /home/ricky/Development/workspace/location_library/LocationLib/bin/build.prop
-post-build:
debug:
nodeps:
-set-mode-check:
-set-debug-files:
-check-env: [checkenv] Android SDK Tools Revision 20.0.1 [checkenv] Installed at /app/android-sdk-linux_86
-setup: [echo] Project Name: ExceptionHandlerLib [gettype] Project Type: Android Library
-set-debug-mode:
-debug-obfuscation-check:
-build-setup: [echo] Resolving Build Target for ExceptionHandlerLib... [gettarget] Project Target: Android 4.1 [gettarget] API level:
16 [echo] ---------- [echo] Creating output directories if needed... [echo] ---------- [echo] Resolving Dependencies for ExceptionHandlerLib... [dependency] Library dependencies: [dependency] No Libraries [dependency] [dependency] ------------------ [dependency] API<=15: Adding annotations.jar to the classpath.-pre-build:
-code-gen: [mergemanifest] No changes in the AndroidManifest files. [echo] Handling aidl files... [aidl] No AIDL files to compile. [echo] ---------- [echo] Handling RenderScript files... [renderscript] No RenderScript files to compile. [echo] ---------- [echo] Handling Resources... [aapt] No changed resources. R.java and Manifest.java untouched. [echo] ---------- [echo] Handling BuildConfig class... [buildconfig] No need to generate new BuildConfig.
-pre-compile:
-compile: [echo] Creating library output jar file...
-post-compile:
-obfuscate:
-dex: [echo] Library project: do not convert bytecode...
-crunch: [crunch] Crunching PNG Files in source dir: /home/ricky/Development/workspace/exception_handler_library/ExceptionHandlerLib/res [crunch] To destination dir: /home/ricky/Development/workspace/exception_handler_library/ExceptionHandlerLib/bin/res [crunch] Crunched 0 PNG files to update cache
-package-resources: [echo] Library project: do not package resources...
-package: [echo] Library project: do not package apk...
-post-package:
-do-debug: [echo] Library project: do not create apk... [propertyfile] Updating property file: /home/ricky/Development/workspace/exception_handler_library/ExceptionHandlerLib/bin/build.prop [propertyfile] Updating property file: /home/ricky/Development/workspace/exception_handler_library/ExceptionHandlerLib/bin/build.prop [propertyfile] Updating property file: /home/ricky/Development/workspace/exception_handler_library/ExceptionHandlerLib/bin/build.prop [propertyfile] Updating property file: /home/ricky/Development/workspace/exception_handler_library/ExceptionHandlerLib/bin/build.prop
-post-build:
debug:
-pre-build:
-code-gen: [mergemanifest] Merging AndroidManifest files into one. [mergemanifest] Merging manifests from project and 2 libraries. [mergemanifest] Warning: [AndroidManifest.xml:3, AndroidManifest.xml:3] Main manifest has but library uses targetSdkVersion='16' [mergemanifest] Note: main manifest lacks a declaration, which defaults to value minSdkVersion or 1. [mergemanifest] Warning: [AndroidManifest.xml:3, AndroidManifest.xml:13] Main manifest has but library uses targetSdkVersion='16' [mergemanifest] Note: main manifest lacks a declaration, which defaults to value minSdkVersion or 1.
BUILD FAILED /app/android-sdk-linux_86/tools/ant/build.xml:616: null
Total time: 2 seconds
EDIT
I looked into /app/android-sdk-linux_86/tools/ant/build.xml:616
and found that the following line threw the null enabled="${manifestmerger.enabled}">
here is the entire block
I am going to try to disable the manifest merger option an see what happens
EDIT
It would seem that removing manifestmerger.enabled=true from project.properties has solved my problem. The project now compiles and works perfectly. I think I should report this bug to the android team. My manifest has the following entry
<uses-sdk android:minSdkVersion="7" />
However onActivityResult() still isn't called if I raise the targetSdkVersion higher than 7, so this doesn't really solve the root problem, but my project is now working properly