0

I am trying to export a signed apk of my project in eclipse , but each time i create a keystore and i want to export it i face this error :

Proguard returned with error code 1. See console

this is my log :

[2017-01-06 13:40:30 - IPTVPlayer] Dx 
trouble writing output: already prepared
[2017-01-06 13:40:30 - IPTVPlayer] ------------------------------
[2017-01-06 13:40:30 - IPTVPlayer] Android Launch!
[2017-01-06 13:40:30 - IPTVPlayer] adb is running normally.
[2017-01-06 13:40:30 - IPTVPlayer] Performing com.simple.iptv.player.Player activity launch
[2017-01-06 13:40:30 - IPTVPlayer] Automatic Target Mode: using device 'VS9804G11989257'
[2017-01-06 13:40:30 - IPTVPlayer] Uploading IPTVPlayer.apk onto device 'VS9804G11989257'
[2017-01-06 13:40:31 - IPTVPlayer] Installing IPTVPlayer.apk...
[2017-01-06 13:40:35 - IPTVPlayer] Success!
[2017-01-06 13:40:36 - IPTVPlayer] Starting activity com.simple.iptv.player.Player on device VS9804G11989257
[2017-01-06 13:40:36 - IPTVPlayer] ActivityManager: Starting: Intent { act=android.intent.action.MAIN cat=[android.intent.category.LAUNCHER] cmp=com.simple.iptv.player/.Player }
[2017-01-06 13:41:18 - IPTVPlayer] New keystore C:\Users\Bahae Eddine\Desktop\Final Application\apk\IPTVPlayer-Final.apk has been created.
[2017-01-06 13:41:18 - IPTVPlayer] Certificate fingerprints:
[2017-01-06 13:41:18 - IPTVPlayer]   MD5 : 73:B4:6D:5E:D1:59:FA:EB:34:8D:2F:F7:19:C7:4D:88
[2017-01-06 13:41:18 - IPTVPlayer]   SHA1: 92:7B:11:C3:1C:3B:67:00:BD:2A:5F:DC:7E:EE:BE:7E:25:4E:E8:64
[2017-01-06 13:41:20 - IPTVPlayer] Proguard returned with error code 1. See console
[2017-01-06 13:41:20 - IPTVPlayer] Error: Can't read [C:\Program Files\Java\jre1.8.0_111\lib\rt.jar] (Can't process class [com/oracle/net/Sdp$1.class] (Unsupported class version number [52.0] (maximum 51.0, Java 1.7)))

this is my proguard-project.txt i have added some lines :

# To enable ProGuard in your project, edit project.properties
# to define the proguard.config property as described in that file.
#
# Add project specific ProGuard rules here.
# By default, the flags in this file are appended to flags specified
# in ${sdk.dir}/tools/proguard/proguard-android.txt
# You can edit the include path and order by changing the ProGuard
# include property in project.properties.
#
# For more details, see
#   http://developer.android.com/guide/developing/tools/proguard.html

# Add any project specific keep options here:

# If your project uses WebView with JS, uncomment the following
# and specify the fully qualified class name to the JavaScript interface
# class:
#-keepclassmembers class fqcn.of.javascript.interface.for.webview {
#   public *;
#}
-keep class android.support.v4.** { *; }   
-dontwarn android.support.v4.**
-dontwarn javax.activation.**
-dontwarn javax.security.**
-dontwarn java.awt.**
-libraryjars <java.home>/lib/rt.jar
-keep class javax.** {*;}
-keep class com.sun.** {*;}
-keep class myjava.** {*;}
-keep class org.apache.harmony.** {*;}
-keep public class Mail {*;}        
-dontshrink

and this is my project.properties :

# This file is automatically generated by Android Tools.
# Do not modify this file -- YOUR CHANGES WILL BE ERASED!
#
# This file must be checked in Version Control Systems.
#
# To customize properties used by the Ant build system edit
# "ant.properties", and override values to adapt the script to your
# project structure.
#
# To enable ProGuard to shrink and obfuscate your code, uncomment this (available properties: sdk.dir, user.home):
#proguard.config=${sdk.dir}/tools/proguard/proguard-android.txt:proguard-project.txt

# Project target.

target=android-20
proguard.config=proguard-project.txt
android.library.reference.1=../google-play-services_lib

1 Answers1

0

The error message say it all: (Unsupported class version number [52.0] (maximum 51.0, Java 1.7)))

=> You are using Java 8 but Proguard only supports Java 7. Hence you have to use Java 7 or change the compile target version of your project to Java 7 (1.7).

Anyway you should switch to AndroidStudio as Android development in Eclipse is no longer supported.

Robert
  • 39,162
  • 17
  • 99
  • 152
  • i changed the compile target to 1.7 but still same problem : http://i.imgur.com/4cen1Jc.png –  Jan 06 '17 at 14:07
  • Have you checked the included JAR files? I assume at least one was compiled with Java 8. – Robert Jan 06 '17 at 14:09
  • and how can i complie them with Java 7 please ? and thank you –  Jan 06 '17 at 14:15
  • First check which JAR is affected (uncompress and check all class files which version it is - see [here](http://stackoverflow.com/questions/1096148/how-to-check-the-jdk-version-used-to-compile-a-class-file) how to do). Then for each affected JAR get the source code and compile it for each used JAR or download a pre-compiled version for Java 6/7 from a trusted source like Maven central repository. – Robert Jan 06 '17 at 14:19