Closed Bug 1338629 Opened 7 years ago Closed 7 years ago

No rule to make target `[...]/tools/lib/lint-checks.jar', needed by `annotationProcessors.jar'. Stop. - AKA can't build with recent SDKs

Categories

(Firefox Build System :: Android Studio and Gradle Integration, defect, P1)

All
Android
defect

Tracking

(fennec+, firefox53 wontfix, firefox54 wontfix, firefox55 fixed)

RESOLVED FIXED
mozilla55
Tracking Status
fennec + ---
firefox53 --- wontfix
firefox54 --- wontfix
firefox55 --- fixed

People

(Reporter: sebastian, Assigned: ahunt)

References

Details

(Whiteboard: [MobileAS])

Attachments

(2 files)

I updated my Android SDK and now the build is failing. Looks like things have moved around again.

>  1:27.13 make[5]: *** No rule to make target `/Users/sebastian/Library/Android/sdk/tools/lib/lint-checks.jar', needed by `annotationProcessors.jar'.  Stop.
>  1:27.13 make[4]: *** [build/annotationProcessors/export] Error 2
>  1:27.13 make[4]: *** Waiting for unfinished jobs....
>  1:27.23 make[3]: *** [export] Error 2
>  1:27.23 make[2]: *** [default] Error 2
>  1:27.23 make[1]: *** [realbuild] Error 2
>  1:27.23 make: *** [build] Error 2
>  1:27.27 211 compiler warnings present.
The lint jars now have a version suffix ("-25.3.0-beta3"). And there's a new lint-api jar. However just updating the build files and adding the new jar is not enough (diff: https://pastebin.mozilla.org/8979132).

> 0:37.52 Note: /Users/sebastian/Projects/Mozilla/central/build/annotationProcessors/SDKProcessor.java uses unchecked or unsafe operations.
> 0:37.52 Note: Recompile with -Xlint:unchecked for details.
> 0:37.74 Processing platform bindings...
> 0:37.76 Exception in thread "main" java.lang.NoClassDefFoundError: com/android/prefs/AndroidLocation$AndroidLocationException
> 0:37.76 	at org.mozilla.gecko.annotationProcessors.SDKProcessor.main(SDKProcessor.java:63)
> 0:37.76 Caused by: java.lang.ClassNotFoundException: com.android.prefs.AndroidLocation$AndroidLocationException
> 0:37.76 	at java.net.URLClassLoader.findClass(URLClassLoader.java:381)
> 0:37.76 	at java.lang.ClassLoader.loadClass(ClassLoader.java:424)
> 0:37.76 	at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:331)
> 0:37.76 	at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
> 0:37.76 	... 1 more
> 0:37.77 make[5]: *** [AndroidRect.h] Error 1
> 0:37.78 make[4]: *** [widget/android/bindings/export] Error 2
> 0:37.78 make[3]: *** [export] Error 2
> 0:37.78 make[2]: *** [default] Error 2
> 0:37.78 make[1]: *** [realbuild] Error 2
> 0:37.78 make: *** [build] Error 2
Apparently this was caused by a busted update. Uninstalling and Re-installing build-tools, sdk-tools and platform-tools fixed the issue.
Status: NEW → RESOLVED
Closed: 7 years ago
Resolution: --- → INVALID
Just wanted to add a note as I've just encountered this issue today and things have changed!  There is no longer a stand alone SDK (or AVD) tool; Android Studio is now your main point of contact (there are still CLI tools, however).  As of today, Fennec relies on Android SDK Build-Tools version 23.0.3 which won't be installed as standard if you uninstall and reinstall the build tools via the Android Studio interface (it installs the most up to date version which is currently 25.0.x) - you must check the "Show Package Details" box at the bottom right of the AVD view in the preferences panel, this will then show you all the past versions
I've installed Android Studio 2.3 few days ago.
I can see "Show package details" checkbox but i can see SDK Build-Tools versions only and no platform-tools.
Flags: needinfo?(martyn)
The problem here is that in the latest Android tools (25.3.x) they have not only renamed the jars which we hardlink to in ./build/annotationProcessors/moz.build (lint.jar & lint-checks.jar), but it seems that there have been some code changes too which result in errors like this if we simply change the filenames back to the previous versions:

0:06.90 error: com.android.tools.lint.client.api.LintClient: class file for com.android.tools.lint.client.api.LintClient not found
 0:06.91 /Users/martyn/Mozilla/src-git/build/annotationProcessors/SDKProcessor.java:36: error: cannot access LintClient
 0:06.91 public class SDKProcessor {
 0:06.91        ^
 0:06.91   class file for com.android.tools.lint.client.api.LintClient not found

to get around this problem for the moment, we need to revert the Android tools version to 25.2.x by following these steps:

Download the 25.2.3 tools zip for your system from these links:

Platform: Windows 	
Link: https://dl.google.com/android/repository/tools_r25.2.3-windows.zip
Size: 292 MB (306,745,639 bytes) 	
SHA-256 checksum: 23d5686ffe489e5a1af95253b153ce9d6f933e5dbabe14c494631234697a0e08

Platform: Mac 		
Link: https://dl.google.com/android/repository/tools_r25.2.3-macosx.zip 	
Size: 191 MB (200,496,727 bytes) 		
SHA-256 checksum: 593544d4ca7ab162705d0032fb0c0c88e75bd0f42412d09a1e8daa3394681dc6

Platform: Linux 		
Link: https://dl.google.com/android/repository/tools_r25.2.3-linux.zip 	
Size: 264 MB (277,861,433 bytes) 		
SHA-256 checksum: 1b35bcb94e9a686dff6460c8bca903aa0281c6696001067f34ec00093145b560


Remove the old tools folder in your $ANDROID_HOME directory and replace it with the unzipped content of the downloaded file.
(In reply to 4ntoine from comment #4)
> I've installed Android Studio 2.3 few days ago.
> I can see "Show package details" checkbox but i can see SDK Build-Tools
> versions only and no platform-tools.

You should see Android SDK Platform-Tools just above Android Sdk Tools 25.x.x as shown in this image
Flags: needinfo?(martyn)
Thanks for the comment, martyn. I've fixed all this errors one-by-one repacking lint.jar each time (i know it's weird but i wanted to make it working somehow eventually).
Status: RESOLVED → REOPENED
Resolution: INVALID → ---
If you're like me and do other Android development, aside from Fennec hacking, which you want to use the latest SDK for, it may be an idea to have two SDK installations: a global SDK which you're free to update, and a separate android-sdk for Fennec which stays on 25.2.3.  This approach has saved me a load of hassle, although you may need to point you Android Studio at the correct SDK location when you switch projects.
It looks like google have decided to split lint+lintchecks into about 6 different jar files, I've got a WIP patch incoming which checks for those and supplies them to our annotation processor commands: with that patch I can now build against sdk 26.2, which contains all the different foo-25.3.1.jar.

I just need to clean that patch up to still allow building against the older sdk (I've got a copy of that locally, I just need to brush up on my build system skills to make everything work correctly...).

Long term we should possibly investigate making our annotation processing more standard. I don't know if the official java annotation processing APIs provide enough information for us, but some of the (Android) APIs that we're currently using have the following scary warning on them:
"NOTE: This is not a public or final API; if you rely on this be prepared to adjust your code for the next tools release."
Assignee: nobody → ahunt
tracking-fennec: --- → ?
Priority: -- → P1
Summary: No rule to make target `[...]/tools/lib/lint-checks.jar', needed by `annotationProcessors.jar'. Stop. → No rule to make target `[...]/tools/lib/lint-checks.jar', needed by `annotationProcessors.jar'. Stop. - AKA can't build with recent SDKs
Whiteboard: [MobileAS]
Oops, I typo'd there. I'm currently building against sdk-tools 26.0.1, not 26.2.
Attachment #8853204 - Flags: review?(nalexander)
Comment on attachment 8853204 [details]
Bug 1338629 - Update annotation processing classpath to reflect SDK 25.3+

https://reviewboard.mozilla.org/r/125288/#review128206

If it's green on try, I'm OK with this.  Leaving the r? just to take that final look.

::: commit-message-9fb5e:3
(Diff revision 3)
> +Bug 1338629 - Update annotation processing classpath to reflect sdk 25.3+
> +
> +It looks like google decided to split these jars out a bit, so we need to piece

nit: Google, SDK.

::: build/annotationProcessors/moz.build:21
(Diff revision 3)
>      'SDKProcessor.java',
>      'utils/AlphabeticAnnotatableEntityComparator.java',
>      'utils/GeneratableElementIterator.java',
>      'utils/Utils.java',
>  ]
> -jar.extra_jars += [
> +jar.extra_jars += CONFIG['ANDROID_LINT_CLASSPATH'].split(' ')

`.split()` without arguments will do better for odd inputs.  See the docs: https://docs.python.org/2/library/stdtypes.html#str.split.

::: build/autoconf/android.m4:365
(Diff revision 3)
>      AC_SUBST(ANDROID_SUPPORT_ANNOTATIONS_JAR_LIB)
>      ;;
>  esac
>  
> +ANDROID_LINT_CLASSPATH=""
> +if test -e $ANDROID_SDK_ROOT/tools/lib/lint.jar ; then

Invert the test order, please: specific version, then generic fallback.

::: build/autoconf/android.m4:368
(Diff revision 3)
>  
> +ANDROID_LINT_CLASSPATH=""
> +if test -e $ANDROID_SDK_ROOT/tools/lib/lint.jar ; then
> +    ANDROID_LINT_CLASSPATH="$ANDROID_LINT_CLASSPATH $ANDROID_SDK_ROOT/tools/lib/lint.jar"
> +    ANDROID_LINT_CLASSPATH="$ANDROID_LINT_CLASSPATH $ANDROID_SDK_ROOT/tools/lib/lint-checks.jar"
> +elif test -e "$ANDROID_SDK_ROOT/tools/lib/lint-25.3.1.jar" ; then

Extract a version number to avoid this duplication, and sort these entries by name.  I think it's worth pushing this version to the `MOZ_ANDROID_SDK` parameter list, since it's a "top-level" thing that we want to make easy to change.  Such a pity this isn't tied to the tools version directly.

::: build/autoconf/android.m4:373
(Diff revision 3)
> +elif test -e "$ANDROID_SDK_ROOT/tools/lib/lint-25.3.1.jar" ; then
> +    ANDROID_LINT_CLASSPATH="$ANDROID_LINT_CLASSPATH $ANDROID_SDK_ROOT/tools/lib/lint-25.3.1.jar"
> +    ANDROID_LINT_CLASSPATH="$ANDROID_LINT_CLASSPATH $ANDROID_SDK_ROOT/tools/lib/lint-checks-25.3.1.jar"
> +    ANDROID_LINT_CLASSPATH="$ANDROID_LINT_CLASSPATH $ANDROID_SDK_ROOT/tools/lib/sdklib-25.3.1.jar"
> +    ANDROID_LINT_CLASSPATH="$ANDROID_LINT_CLASSPATH $ANDROID_SDK_ROOT/tools/lib/repository-25.3.1.jar"
> +    ANDROID_LINT_CLASSPATH="$ANDROID_LINT_CLASSPATH $ANDROID_SDK_ROOT/tools/lib/common-25.3.1.jar"

Are you really certain you need `common`, `sdklib`, etc?  For just `build/annotationProcessor`, I did not; but perhaps `widget/android/bindings` really does.
Comment on attachment 8853204 [details]
Bug 1338629 - Update annotation processing classpath to reflect SDK 25.3+

https://reviewboard.mozilla.org/r/125288/#review128242

Green on try and it's good for me.  Thanks!

::: commit-message-9fb5e:1
(Diff revisions 3 - 4)
>  Bug 1338629 - Update annotation processing classpath to reflect sdk 25.3+

nit: SDK.
Attachment #8853204 - Flags: review?(nalexander) → review+
Pushed by ahunt@mozilla.com:
https://hg.mozilla.org/integration/autoland/rev/e701cc8a939c
Update annotation processing classpath to reflect SDK 25.3+ r=nalexander
https://hg.mozilla.org/mozilla-central/rev/e701cc8a939c
Status: REOPENED → RESOLVED
Closed: 7 years ago7 years ago
Resolution: --- → FIXED
Target Milestone: --- → Firefox 55
tracking-fennec: ? → +
Product: Firefox for Android → Firefox Build System
Target Milestone: Firefox 55 → mozilla55
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Creator:
Created:
Updated:
Size: