Saturday, December 30, 2017

How to update ProGuard for Android SDK

If still using Eclipse for Android app development and targeting newer Android SDK versions you may find ProGuard failing with this error message:
Can't process class [junit/runner/Version.class] (Unsupported class version number [52.0] (maximum 51.0, Java 1.7)) 
Proguard returned with error code 1. See console
Proguard Error 1 
Output: Can't read [U:\Android\android-sdk\platforms\android-27\android.jar] (Can't process class [junit/runner/Version.class] (Unsupported class version number [52.0] (maximum 51.0, Java 1.7))) 
 at proguard.InputReader.readInput( 
 at proguard.InputReader.readInput( 
 at proguard.InputReader.readInput( 
 at proguard.InputReader.execute( 
 at proguard.ProGuard.readInput( 
 at proguard.ProGuard.execute( 
 at proguard.ProGuard.main( 
Caused by: Can't process class [junit/runner/Version.class] (Unsupported class version number [52.0] (maximum 51.0, Java 1.7)) 
 at proguard.InputReader.readInput( 
 ... 6 more 
Caused by: java.lang.UnsupportedOperationException: Unsupported class version number [52.0] (maximum 51.0, Java 1.7) 
 at proguard.classfile.util.ClassUtil.checkVersionNumbers( 
 at proguard.classfile.LibraryClass.accept( 
 ... 11 more 


Newer versions of Android platform are compiled as Java 8 binary and ProGuard 4.7 coming with Android SDK Tools doesn't support it (last updated with SDK Tools Revision 17, March 2012).
> cd \android-sdk\tools\proguard\bin
> proguard
ProGuard, version 4.7
Usage: java proguard.ProGuard [options ...]


Java 8 support is available with Proguard 5.x onwards, so we will update to the latest version available, in my case 5.3.3 from Apr 2017.
  1. Move / rename the old version:
    rename \android-sdk\tools\proguard\ proguard.old
  2. Download the zip file from SourceForce
  3. Extract the contents into \android-sdk\tools\ renaming the new folder to proguard
    rename \android-sdk\tools\proguard5.3.3\ proguard
  4. Check the new version:
    > cd \android-sdk\tools\proguard\bin\
    > proguard
    ProGuard, version 5.3.3
    Usage: java proguard.ProGuard [options ...]
  5. Copy the Android configuration files over:
    > cd \android-sdk\tools\
    > copy proguard.old\proguard-*.txt proguard\
            3 file(s) copied.
Exporting the APK package again should work now.

Monday, December 11, 2017

Fix: Wireless Display "Your display couldn't connect"

 You may find when trying to project to an wireless display Windows will fail with the following error message, even though other similar computers on your network can project just fine:

    Something went wrong.
    Your display couldn't connect.

Intel ProSet/Wireless Software > Modify > Wireless Software Extensions

Windows Defender Security Center > Firewall & network protection > Restore firewalls to default

Try again projecting and confirm it is working fine now.