Proguard error with parse - parse-platform

I built with parse 1.5.1 without problems when progurad only add one line.
-keep class com.parse.** { *; }
I upgraded parse to 1.9.4 ,but parse didn't work.
I reference others topics and I added below lines still didn't work.
I can ignore the parse warning,but it can't solve any problems.
-keepattributes Annotation,SourceFile,LineNumberTable
-keepattributes Signature
-keep interface com.parse.** { *; }
-keep class com.parse.** { *; }
-keep class com.squareup.** { *; }
-keep interface com.squareup.** { *; }
I got error when I built the release version with Parse 1.9.4.
[2015-08-13 10:49:29 - wargame] Proguard returned with error code 1. See console
[2015-08-13 10:49:29 - wargame] Warning: com.parse.ParseOkHttpClient$CountingOkHttpRequestBody: can't find superclass or interface com.squareup.okhttp.RequestBody
[2015-08-13 10:49:29 - wargame] Warning: com.parse.ParseOkHttpClient: can't find referenced class com.squareup.okhttp.OkHttpClient
[2015-08-13 10:49:29 - wargame] Warning: com.parse.ParseOkHttpClient: can't find referenced class com.squareup.okhttp.Response
[2015-08-13 10:49:29 - wargame] Warning: com.parse.ParseOkHttpClient: can't find referenced class com.squareup.okhttp.ResponseBody
[2015-08-13 10:49:29 - wargame] Warning: com.parse.ParseOkHttpClient: can't find referenced class com.squareup.okhttp.Request$Builder
[2015-08-13 10:49:29 - wargame] Warning: com.parse.ParseOkHttpClient$1: can't find referenced class com.squareup.okhttp.Call
[2015-08-13 10:49:29 - wargame] Warning: com.parse.ParseOkHttpClient$CountingOkHttpRequestBody: can't find referenced class com.squareup.okhttp.RequestBody
[2015-08-13 10:49:29 - wargame] Warning: com.parse.ParseOkHttpClient$CountingOkHttpRequestBody: can't find referenced class okio.BufferedSink
[2015-08-13 10:49:29 - wargame] You should check if you need to specify additional program jars.
[2015-08-13 10:49:29 - wargame] Warning: there were 72 unresolved references to classes or interfaces.
[2015-08-13 10:49:29 - wargame] You may need to specify additional library jars (using '-libraryjars').
[2015-08-13 10:49:29 - wargame] Error: Please correct the above warnings first.

I had these issue myself so I asked parse for help. They came up with the following proguard file:
# Keep source file names, line numbers, and Parse class/method names for easier debugging
-keepattributes SourceFile,LineNumberTable
-keepnames class com.parse.** { *; }
# Required for Parse
-keepattributes *Annotation*
-keepattributes Signature
-dontwarn com.squareup.**
-dontwarn okio.**

Related

Getting these errors while trying to build this repo/code?

Can Someone point me in the right direction about what this error is all about , as i'm fairly new to Java and all this building stuff.
the below Code is terminal output that is received after building
ubuntu#ip-172-31-43-23 ~/j/java-NFTB (develop)> ./gradlew build
Starting a Gradle Daemon (subsequent builds will be faster)
> Task :protocol:compileJava
/home/ubuntu/java-nftb/java-NFTB/protocol/src/main/java/org/nftb/api/WalletGrpc.java:20: error: cannot find symbol
#javax.annotation.Generated(
^
symbol: class Generated
location: package javax.annotation
/home/ubuntu/java-nftb/java-NFTB/protocol/src/main/java/org/nftb/api/WalletExtensionGrpc.java:20: error: cannot find symbol
#javax.annotation.Generated(
^
symbol: class Generated
location: package javax.annotation
/home/ubuntu/java-nftb/java-NFTB/protocol/src/main/java/org/nftb/api/DatabaseGrpc.java:23: error: cannot find symbol
#javax.annotation.Generated(
^
symbol: class Generated
location: package javax.annotation
/home/ubuntu/java-nftb/java-NFTB/protocol/src/main/java/org/nftb/api/MonitorGrpc.java:20: error: cannot find symbol
#javax.annotation.Generated(
^
symbol: class Generated
location: package javax.annotation
/home/ubuntu/java-nftb/java-NFTB/protocol/src/main/java/org/nftb/api/nftbZksnarkGrpc.java:20: error: cannot find symbol
#javax.annotation.Generated(
^
symbol: class Generated
location: package javax.annotation
/home/ubuntu/java-nftb/java-NFTB/protocol/src/main/java/org/nftb/api/WalletSolidityGrpc.java:20: error: cannot find symbol
#javax.annotation.Generated(
^
symbol: class Generated
location: package javax.annotation
/home/ubuntu/java-nftb/java-NFTB/protocol/src/main/java/org/nftb/api/NetworkGrpc.java:23: error: cannot find symbol
#javax.annotation.Generated(
^
symbol: class Generated
location: package javax.annotation
7 errors
> Task :protocol:compileJava FAILED
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':protocol:compileJava'.
Sorry, if i've made any mistakes please feel free to correct me as i am new to stackoverflow
You have to go to build.gradle file and make sure you have all the dependencies you need .
for example , here you are missing this
implementation 'javax.annotation:javax.annotation-api:1.2'
You can add and try to rebuild again , also please make sure to add the build.gradle code for next time .

Gradle Test Fails in CircleCI- Could not find symbols for Lombok Generated Code

I have a Spring Boot application with Gradle. I tried upgrading to Spring Boot 2.1.0.RELEASE. I also had to upgrade Gradel Wrapper in gradle-wrapper.properties like this:
distributionUrl=https\://services.gradle.org/distributions/gradle-4.6-bin.zip
My code uses Lombok 1.18.2
Locally, my application tests runs correctly. However, CircleCI build fails, like this.
!/bin/bash -eo pipefail
gradle test
Task :compileJava
/home/circleci/repo/src/main/java/guru/springframework/spring5webfluxrest/bootstrap/Bootstrap.java:31: error: cannot find symbol
categoryRepository.save(Category.builder()
^
symbol: method builder()
location: class Category
/home/circleci/repo/src/main/java/guru/springframework/spring5webfluxrest/bootstrap/Bootstrap.java:34: error: cannot find symbol
categoryRepository.save(Category.builder()
^
symbol: method builder()
location: class Category
/home/circleci/repo/src/main/java/guru/springframework/spring5webfluxrest/bootstrap/Bootstrap.java:37: error: cannot find symbol
categoryRepository.save(Category.builder()
^
symbol: method builder()
location: class Category
/home/circleci/repo/src/main/java/guru/springframework/spring5webfluxrest/bootstrap/Bootstrap.java:40: error: cannot find symbol
categoryRepository.save(Category.builder()
^
symbol: method builder()
location: class Category
/home/circleci/repo/src/main/java/guru/springframework/spring5webfluxrest/bootstrap/Bootstrap.java:43: error: cannot find symbol
categoryRepository.save(Category.builder()
^
symbol: method builder()
location: class Category
/home/circleci/repo/src/main/java/guru/springframework/spring5webfluxrest/bootstrap/Bootstrap.java:48: error: cannot find symbol
vendorRepository.save(Vendor.builder()
^
symbol: method builder()
location: class Vendor
/home/circleci/repo/src/main/java/guru/springframework/spring5webfluxrest/bootstrap/Bootstrap.java:52: error: cannot find symbol
vendorRepository.save(Vendor.builder()
^
symbol: method builder()
location: class Vendor
/home/circleci/repo/src/main/java/guru/springframework/spring5webfluxrest/bootstrap/Bootstrap.java:56: error: cannot find symbol
vendorRepository.save(Vendor.builder()
^
symbol: method builder()
location: class Vendor
/home/circleci/repo/src/main/java/guru/springframework/spring5webfluxrest/bootstrap/Bootstrap.java:60: error: cannot find symbol
vendorRepository.save(Vendor.builder()
^
symbol: method builder()
location: class Vendor
/home/circleci/repo/src/main/java/guru/springframework/spring5webfluxrest/bootstrap/Bootstrap.java:64: error: cannot find symbol
vendorRepository.save(Vendor.builder()
^
symbol: method builder()
location: class Vendor
10 errors
Task :compileJava FAILED
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':compileJava'.
> Compilation failed; see the compiler error output for details.
* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --
debug option to get more log output. Run with --scan to get full insights.
* Get more help at https://help.gradle.org
BUILD FAILED in 3s
1 actionable task: 1 executed
Exited with code 1
Please help.
Try change gradle and use ./gradlew under the steps: section in the config.yml as the template below:
version: 2
jobs:
build:
docker:
# specify the version you desire here
- image: circleci/openjdk:8-jdk
# Specify service dependencies here if necessary
# CircleCI maintains a library of pre-built images
# documented at https://circleci.com/docs/2.0/circleci-images/
# - image: circleci/postgres:9.4
working_directory: ~/repo
environment:
# Customize the JVM maximum heap limit
JVM_OPTS: -Xmx3200m
TERM: dumb
steps:
- checkout
# Download and cache dependencies
- restore_cache:
keys:
- v1-dependencies-{{ checksum "build.gradle" }}
# fallback to using the latest cache if no exact match is found
- v1-dependencies-
- run: ./gradlew dependencies # <-- changed from `gradle dependencies`
- save_cache:
paths:
- ~/.gradle
key: v1-dependencies-{{ checksum "build.gradle" }}
# run tests!
- run: ./gradlew test # <-- changed from `gradle test`
What worked for me was add "annotationProcessor" to build.gradle dependencies (it was not building locally either).
dependencies {
compileOnly 'org.projectlombok:lombok'
annotationProcessor 'org.projectlombok:lombok'
}
Use annotationProcessor 'org.projectlombok:lombok' in build.gradle in dependencies. It will work smooth.

java.exe exited with code 1

I'm using vs 2017 and xamarin.forms.
I'm getting the error "java.exe exited with 1" in the release mode with ProGuard turned on. (in the debug & without proguard its doing fine) It's a common question, i know , but i've tried all the variants and it still doesnt work.
1.tried to update proguard to 5.3 version manualy
2.to update jdk 8, to install either x64 or x86 or both
3.to change the java memory to 1g , 4g, 500 m
4.to turn on multi-desk
to edit the proguard-android.txt by adding
-keep class com.google.android.gms.** { *; }
-dontwarn com.google.android.gms.**
(These just ignore proguard, google play doesnt accept it.)
ANY OTHER VARIANTS HERE?
com.google.android.gms.gcm.GcmNetworkManager: can't find referenced method 'java.lang.Object zzb(java.lang.Object,java.lang.Object)' in program class com.google.android.gms.common.internal.zzu
there were 3 unresolved references to program class members.
com.google.android.gms.gcm.GcmNetworkManager: can't find referenced method 'void zzb(boolean,java.lang.Object)' in program class com.google.android.gms.common.internal.zzu
there were 1 unresolved references to library class members.
com.google.android.gms.gcm.Task$Builder: can't find referenced method 'void zzb(boolean,java.lang.Object)' in program class com.google.android.gms.common.internal.zzu
com.google.android.gms.gcm.zza: can't find referenced method 'void setLatestEventInfo(android.content.Context,java.lang.CharSequence,java.lang.CharSequence,android.app.PendingIntent)' in library class android.app.Notification

Xamarin.Android Proguard - Unsupported class version number 52.0

I'm trying to use Proguard in my Xamarin.Android project, yet the compilation fails with the error Unsupported class version number [52.0] (maximum 51.0, Java 1.7)
I saw from those two questions that it may be a mismatch between Java 7 and Java 8, more precisely some versions of proguard don't support Java 8. However in Xamarin Preferences -> SDK Location, Java SDK points to JDK 7 : /Library/Java/JavaVirtualMachines/jdk1.7.0_79.jdk/Contents/Home
Is there any place where proguard can be configured more precisely ? Any other idea ?
Here's the failure log :
java.io.IOException: Can't read
[/Library/Frameworks/Xamarin.Android.framework/Versions/7.0.0-18/lib/xbuild-frameworks/MonoAndroid/v7.0/mono.android.jar]
(Can't process class [android/app/ActivityTracker.class] (Unsupported
class version number [52.0] (maximum 51.0, Java 1.7))) at
proguard.InputReader.readInput(InputReader.java:230) at
proguard.InputReader.readInput(InputReader.java:200) at
proguard.InputReader.readInput(InputReader.java:178) at
proguard.InputReader.execute(InputReader.java:78) at
proguard.ProGuard.readInput(ProGuard.java:196) at
proguard.ProGuard.execute(ProGuard.java:78) at
proguard.ProGuard.main(ProGuard.java:492) Caused by:
java.io.IOException: Can't process class
[android/app/ActivityTracker.class] (Unsupported class version number
[52.0] (maximum 51.0, Java 1.7)) at
proguard.io.ClassReader.read(ClassReader.java:112) at
proguard.io.FilteredDataEntryReader.read(FilteredDataEntryReader.java:87)
at proguard.io.JarReader.read(JarReader.java:65) at
proguard.io.DirectoryPump.readFiles(DirectoryPump.java:65) at
proguard.io.DirectoryPump.pumpDataEntries(DirectoryPump.java:53) at
proguard.InputReader.readInput(InputReader.java:226) ... 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(ClassUtil.java:140)
at
proguard.classfile.io.ProgramClassReader.visitProgramClass(ProgramClassReader.java:88)
at proguard.classfile.ProgramClass.accept(ProgramClass.java:346) at
proguard.io.ClassReader.read(ClassReader.java:91) ... 11 more
9 Warning(s) 1 Error(s)
You need to update the default Android SDK proguard.jar with the latest version of Proguard found here:
https://sourceforge.net/projects/proguard/files/
I would recommend that you install this on the side of the default version that Android ships in android-sdk\tools\proguard. Simply rename the existing folder to something else and add the new version of proguard.
This is listed in the Xamarin.Android 7.0 release notes:
https://developer.xamarin.com/releases/android/xamarin.android_7/xamarin.android_7.0/
In which the following bug was logged as well:
https://bugzilla.xamarin.com/show_bug.cgi?id=44187
Which is coordinated with a Pull Request in the Xamarin.Android repository:
https://github.com/xamarin/xamarin-android/pull/209
I had a problem where Proguard was removing the Google Play Services libraries from my app.
In addition to following #Jon Douglas' answer above, I had to add the following lines of text to the proguard-android.txt file found in this folder:
/(Path to your Android SDK Folder)/tools/proguard
-keep public class com.google.android.gms.* { public *; }
-dontwarn com.google.android.gms.**
Complete proguard-android.txt File
-keep public class com.google.android.gms.* { public *; }
-dontwarn com.google.android.gms.**
# This is a configuration file for ProGuard.
# http://proguard.sourceforge.net/index.html#manual/usage.html
-dontusemixedcaseclassnames
-dontskipnonpubliclibraryclasses
-verbose
# Optimization is turned off by default. Dex does not like code run
# through the ProGuard optimize and preverify steps (and performs some
# of these optimizations on its own).
-dontoptimize
-dontpreverify
# Note that if you want to enable optimization, you cannot just
# include optimization flags in your own project configuration file;
# instead you will need to point to the
# "proguard-android-optimize.txt" file instead of this one from your
# project.properties file.
-keepattributes *Annotation*
-keep public class com.google.vending.licensing.ILicensingService
-keep public class com.android.vending.licensing.ILicensingService
# For native methods, see http://proguard.sourceforge.net/manual/examples.html#native
-keepclasseswithmembernames class * {
native <methods>;
}
# keep setters in Views so that animations can still work.
# see http://proguard.sourceforge.net/manual/examples.html#beans
-keepclassmembers public class * extends android.view.View {
void set*(***);
*** get*();
}
# We want to keep methods in Activity that could be used in the XML attribute onClick
-keepclassmembers class * extends android.app.Activity {
public void *(android.view.View);
}
# For enumeration classes, see http://proguard.sourceforge.net/manual/examples.html#enumerations
-keepclassmembers enum * {
public static **[] values();
public static ** valueOf(java.lang.String);
}
-keepclassmembers class * implements android.os.Parcelable {
public static final android.os.Parcelable$Creator CREATOR;
}
-keepclassmembers class **.R$* {
public static <fields>;
}
# The support library contains references to newer platform versions.
# Don't warn about those in case this app is linking against an older
# platform version. We know about them, and they are safe.
-dontwarn android.support.**
# Understand the #Keep support annotation.
-keep class android.support.annotation.Keep
-keep #android.support.annotation.Keep class * {*;}
-keepclasseswithmembers class * {
#android.support.annotation.Keep <methods>;
}
-keepclasseswithmembers class * {
#android.support.annotation.Keep <fields>;
}
-keepclasseswithmembers class * {
#android.support.annotation.Keep <init>(...);
}
Simple Answer
According to documentation you need update proguard version (starting from version 5 it support Java 8 ) and make sure you are using jdk1.8
JDK 1.8 - up to API 24+
JDK 1.7 - up to API 23
JDK 1.6 - up to API 20
how to update from package console write this command
PM> Install-Package name.atsushieno.proguard.facebook
https://www.nuget.org/packages/name.atsushieno.proguard.facebook
or download proguard manually and replace it with current version
YOUR_SDK --> tools --> proguard --> (delete all old files , unzip new version )
Detailed Answer if you enable target android Nogut and you enable Multi-Dex or ProGuard you need use proper ProGuard version (as ToolMakerSteve said they have dependency on ProGuard)
so make sure you target java 8 from tools ->options ->xamarin ->java and update ProGuard version
Update Answer
make sure your support library version compatible with target version , if you target
Android 7 (api 24) mean your support library should be 24
Android 7.1 (api 25 ) mean your support library should be 25
to all support library and if you using google play services as well
I was also facing the same issue on my Windows 10 x64 and visual studio 2015. I have set the JDK path to JDK 1.8 under android settings in Visual studio
tools ->options ->xamarin ->java development kit location. it was pointing to "C:\Program Files (x86)\Java\jdk1.7.0_55" and I made it to "C:\Program Files\Java\jdk1.8.0_31", and issue has been fixed.
Using Visual Studio
If you are using Visual Studio 2017 or 2019, please note that these applications pack their proguard. For 2019, proguard version: 5.3.2. For me, I needed version 6.0.3, so I made a backup of the proguard.jar file at:
C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\MSBuild\Xamarin\Android\proguard\lib
And copied the latest one from zip from the sourceforge site.
To get ProGuard work, you have to follow few steps
First Download latest ProGuard file from here, unzip and paste in your android-sdk\tools\proguard folder
First you need to add proguard.cfg to your android project level.
Change proguard.cfg file build action to ProguardConfiguration Change
proguard.cfg file Encoding using Notepad++ to UTF-8
If you are getting warnings then you need to use -dontwarn attribute like below
-dontwarn com.symbol.emdk.**
-dontwarn org.apache.http.**
-dontwarn com.appdynamics.eumagent.runtime.**
You must need to remove/solve warning because that cause errors. Above code will remove all of your warnings.
If you are getting exception after executing your application you need to use -keep attribute. like below for required classes
-keep public class android.support.v7.widget.** { *; }

Does proguard support GCM?

I receive this error when I try to rebuild app with proguard: (I tried all the solutions suggested for the error MSB6006: "java.exe" exited with code 1, but in my case, it seems have some conflicts with GCM )
19>PROGUARD : warning :
com.google.android.gms.common.GooglePlayServicesUtil: can't find
referenced method 'void
setLatestEventInfo(android.content.Context,java.lang.CharSequence,java.lang.CharSequence,android.app.PendingIntent)'
in class android.app.Notification 19>PROGUARD : warning :
com.google.android.gms.gcm.zza: can't find referenced method 'void
setLatestEventInfo(android.content.Context,java.lang.CharSequence,java.lang.CharSequence,android.app.PendingIntent)'
in class android.app.Notification 19> You should check if you
need to specify additional program jars. 19>PROGUARD : warning : there
were 2 unresolved references to program class members. 19>
Your input classes appear to be inconsistent. 19> You may
need to recompile them and try again. 19> Alternatively, you
may have to specify the option 19>
'-dontskipnonpubliclibraryclassmembers'. 19> java.io.IOException:
Please correct the above warnings first. 19> at
proguard.Initializer.execute(Initializer.java:321) 19> at
proguard.ProGuard.initialize(ProGuard.java:211) 19> at
proguard.ProGuard.execute(ProGuard.java:86) 19> at
proguard.ProGuard.main(ProGuard.java:492) 19> Picked up
JAVA_TOOL_OPTIONS: -Dfile.encoding=UTF8 19>C:\Program Files
(x86)\MSBuild\Xamarin\Android\Xamarin.Android.Common.targets(2118,3):
error MSB6006: "java.exe" exited with code 1.
The Google GMS libraries sometimes try to access library methods that are not available for a given target SDK version and gracefully handle errors at runtime. So it is usually required and safe to add something like this to ignore such warnings:
-dontwarn com.google.android.gms.**
-dontnote com.google.android.gms.**
These rules will ignore all warnings and notes from the gms libraries.
I solved it with this solution from Xamarin forum:
Create file named proguard.cfg inside Android project in the solution. Right click and set Build Action to ProguardConfig.
Add the following lines:
-keep class com.google.android.gms.** { *; }
-dontwarn com.google.android.gms.**
Amend the above according to type of errors you're getting
Make sure you save file as UTF-8 and NOT UTF-8 BOM
Compile version: 6.0
Min target: 5.1
Target version: 6.0

Resources