get error from proguard - android

When I try to export an .apk file it gives me this error:
[2013-06-10 13:46:47 -] Proguard returned with error code 1. See console
[2013-06-10 13:46:47 -] Warning: com.facebook.widget.FacebookFragment: can't find referenced method 'android.support.v4.app.FragmentActivity getActivity()' in class com.facebook.widget.FacebookFragment
What could be the reason for it? I dont understand what dontskipnonpubliclibraryclassmembers means?
Thanks

Related

Proguard - can't find referenced method

I have to upgrade my build tool to com.android.tools.build:gradle:3.1.3 with gradle 4.4. My project worked well with proguard previously. But after upgrading, there are a lot of issues as the one below:
MainActivity: can't find referenced method 'void setAlpha(float)' in program class android.view.View
...can't find referenced method 'void execute(java.lang.Runnable)' in program class android.os.AsyncTask
...can't find referenced method 'void overridePendingTransition(int,int)'
...can't find referenced method 'boolean canPause()' in program class android.widget.VideoView
Warning: library class android.app.AlarmManager$AlarmClockInfo depends on program class android.os.Parcelable$Creator
Warning: library class android.graphics.drawable.AdaptiveIconDrawable extends or implements program class android.graphics.drawable.Drawable
What did I miss in my proguard file?
After taking a lot of time looking at the log cat, I saw that every referenced method was Added in API level 11 or above (I am using if/else check) and my min sdk was 15. Any suggestion?
Proguard version is updated with the buildtools, maybe this is an issue with that Proguard version. Have you tried to downgrade (or updgrade) manually your Proguard version to see if the error still occurs ?
override it like this
buildscript {
configurations.all {
resolutionStrategy {
force 'net.sf.proguard:proguard-gradle:x.x.x' //here use whatever version you'd like
}
}
}
and look up your proguard version like this
./gradlew buildEnvironment

Proguard application's ClassLoader Error

Proguard in android application is throwing a Runtime error -
java.security.InvalidParameterException: Unable to locate the specified interface com.example.abc in the application's ClassLoader! A typo?
Could anyone please help to resolve the error.

Proguard build failed(Eclipse)

This question already have been asked many times, but I am not able to resolve it. I am trying to export my app using eclipse for final release, but I am getting the below error.
I already added
-keep class com.afollestad.materialdialogs.*{ *; }
-dontwarn com.afollestad.materialdialogs.**
-dontshrink
Error resolved, but after running my app crashed.
please help me
this is the error:
Proguard returned with error code 1. See console
Warning: com.afollestad.materialdialogs.util.DialogUtils: can't find referenced method 'android.content.res.ColorStateList getColorStateList(int)' in class android.content.Context
Warning: com.afollestad.materialdialogs.util.DialogUtils: can't find referenced method 'int getColor(int)' in class android.content.Context
You should check if you need to specify additional program jars.
Warning: there were 2 unresolved references to program class members.
Your input classes appear to be inconsistent.
You may need to recompile them and try again.
Alternatively, you may have to specify the option
dontskipnonpubliclibraryclassmembers'.
java.io.IOException: Please correct the above warnings first.
at proguard.Initializer.execute(Initializer.java:321)
at proguard.ProGuard.initialize(ProGuard.java:211)
at proguard.ProGuard.execute(ProGuard.java:86)

ant release proguard fails, but under eclipse works

I have a pretty big project with an elaborate proguard.cfg .
This project builds OK under eclipse, proguard runs without errors, and the app works perfectly, it's been my normal workflow for months.
I am trying to build it from command line using ant.
I have updated build.xml, etc.. on the projects and its library project using
android update project -p .
android update project -s --target android-17 -p .
The debug version, ant debug, gets built successfully
However, ant release fails proguard, complaining about missing classes.
From what I could decipher (a lot of non-faltal warnings pop up) the problems are related to a missing inner class in one of my (thousand) classes, and to missing R (resources) of a dependent library project. This is strange, both things do exist, the library projects gets built OK from eclipse & ant, and that inner class i don't know, the parent class is pretty trivial.
Why does it build under eclipse and not using command line? Shouldn't the updated build scripts produce the same result?
Proguard: Errors Related to LIbrary Project Resources
[proguard] Warning: com.jeremyfeinstein.slidingmenu.lib.CustomViewBehind: can't find referenced class com.jeremyfeinstein.slidingmenu.lib.R$id
[proguard] Warning: com.jeremyfeinstein.slidingmenu.lib.CustomViewBehind: can't find referenced class com.jeremyfeinstein.slidingmenu.lib.R$id
[proguard] Warning: com.jeremyfeinstein.slidingmenu.lib.CustomViewBehind: can't find referenced class com.jeremyfeinstein.slidingmenu.lib.R
[proguard] Warning: com.jeremyfeinstein.slidingmenu.lib.SlidingMenu: can't find referenced class com.jeremyfeinstein.slidingmenu.lib.R$styleable
[proguard] Warning: com.jeremyfeinstein.slidingmenu.lib.SlidingMenu: can't find referenced class com.jeremyfeinstein.slidingmenu.lib.R$styleable
[proguard] Warning: com.jeremyfeinstein.slidingmenu.lib.SlidingMenu: can't find referenced class com.jeremyfeinstein.slidingmenu.lib.R
[proguard] Warning: com.jeremyfeinstein.slidingmenu.lib.app.SlidingActivityHelper: can't find referenced class com.jeremyfeinstein.slidingmenu.lib.R$layout
[proguard] Warning: com.jeremyfeinstein.slidingmenu.lib.app.SlidingActivityHelper: can't find referenced class com.jeremyfeinstein.slidingmenu.lib.R$layout
[proguard] Warning: com.jeremyfeinstein.slidingmenu.lib.app.SlidingActivityHelper: can't find referenced class com.jeremyfeinstein.slidingmenu.lib.R
Proguard: Related to inner class not found
[proguard] Warning: com.regaliz.gui.layouts.FunqRootLayout$2: can't find referenced class com.regaliz.gui.layouts.FunqRootLayout$1
[proguard] Warning: com.regaliz.gui.layouts.FunqRootLayout$3: can't find referenced class com.regaliz.gui.layouts.FunqRootLayout$1
[proguard] Warning: com.regaliz.gui.layouts.FunqRootLayout$SimpleAnimationListener: can't find referenced class com.regaliz.gui.layouts.FunqRootLayout$1
[proguard] Warning: com.regaliz.gui.layouts.FunqRootLayout$SimpleAnimationListener: can't find referenced class com.regaliz.gui.layouts.FunqRootLayout$1
[proguard] Warning: com.regaliz.gui.layouts.FunqRootLayout$SimpleAnimationListener: can't find referenced class com.regaliz.gui.layouts.FunqRootLayout$1
That's strange, I found the problem by trial and error.
The inner class not found was an innocent private anonymous runnable like:
private Runnable mBlinkRunner=new Runnable() {
public void run() {
.
. couple simple lines
.
}
};
I changed it to ...
protected Runnable mBlinkRunner=new Runnable() {
public void run() {
.
. couple simple lines
.
}
};
and it worked... I wonder why this happens, there should be like hundreds of runnables like these through the project.

Could not find class error when trying to upload a video to YouTube using the gdata API

I am currently writing part of an Android application to upload a video to YouTube using the Google Data API. I have the latest version of the API from Google Code, and I have basically copied the example from their Developer's Guide for the time being.
Everything compiles with no warnings or errors, and the app runs fine. But when I call service.insert(...) I get the following stack trace:
ERROR/dalvikvm(19489): Could not find class 'com.google.gdata.data.media.MediaBodyPart$MediaSourceDataHandler', referenced from method com.google.gdata.data.media.MediaBodyPart.initMediaDataHandler
ERROR/dalvikvm(19489): Could not find class 'javax.activation.DataHandler', referenced from method com.google.gdata.data.media.MediaBodyPart.initMediaDataHandler
ERROR/dalvikvm(19489): Could not find class 'javax.mail.internet.MimeBodyPart$MimePartDataHandler', referenced from method javax.mail.internet.MimeBodyPart.writeTo
ERROR/dalvikvm(19489): Could not find class 'javax.activation.DataHandler', referenced from method javax.mail.internet.MimeBodyPart.attachFile
ERROR/dalvikvm(19489): Could not find class 'javax.mail.internet.MimeBodyPart$MimePartDataHandler', referenced from method javax.mail.internet.MimeBodyPart.getDataHandler
ERROR/dalvikvm(19489): Could not find class 'javax.activation.DataHandler', referenced from method javax.mail.internet.MimeBodyPart.setContent
ERROR/dalvikvm(19489): Could not find class 'javax.activation.DataHandler', referenced from method javax.mail.internet.MimeBodyPart.setContent
ERROR/dalvikvm(19489): Could not find class 'javax.activation.DataHandler', referenced from method javax.mail.internet.MimeBodyPart.updateHeaders
with a NoClassDefFoundError.
I have all the dependencies for the gdata API linked to my project in Eclipse (the two included in the deps directory of the API, and also javamail, activation and servlet-api), and I have tried adding all the jar files to the classpath in Eclipse. I have looked through the relevant jars and all the classes it claims it can't find are definitely there.
If anyone could help in any way - any ideas at this stage would be greatly appreciated.
Thanks
It turned out that the normal JavaMail/Activation packages currently don't work on Android. The solution was to use JavaMail for Android, which works perfectly.

Categories

Resources