SplashActivity being removed by ProGuard?

41 views
Skip to first unread message

Ken Restivo

unread,
Dec 21, 2015, 9:44:24 PM12/21/15
to clojure...@googlegroups.com
I've been trying to port an app from old neko (from 2 years ago) to new neko. I'm almost done; the last step is to try this lean compile.

Latest confusing thing I've run up against is, in the lean profile, the SplashActivity classes are getting removed from the final apk by something.

It's not proguard, because after setting proguard-execute to false, still the SplashActivity isn't there.

My java-source-paths are set correctly, and the classes are definitely getting compiled, becasue I see them there in the filesystem after the compile is done.

Baffling.

Any ideas?

-ken

Alexander Yakushev

unread,
Dec 22, 2015, 2:26:00 AM12/22/15
to clojure...@googlegroups.com

How far can you track SplashActivity class? Is it gone while DEXing, or after building the APK? You can search for apktool and baksmali tools to assist you with this.


--
You received this message because you are subscribed to the Google Groups "clojure-android" group.
To unsubscribe from this group and stop receiving emails from it, send an email to clojure-andro...@googlegroups.com.
To post to this group, send email to clojure...@googlegroups.com.
Visit this group at https://groups.google.com/group/clojure-android.
For more options, visit https://groups.google.com/d/optout.

Ken Restivo

unread,
Dec 25, 2015, 9:33:41 PM12/25/15
to clojure...@googlegroups.com
I decompiled it, and the SplashActivity definitely is not there after building the APK.

So. In target/release/classes/... is the SplashActivity

In the APK, decompiled, there is no SplashActivity.

Ken Restivo

unread,
Dec 25, 2015, 9:42:35 PM12/25/15
to clojure...@googlegroups.com
And, baksmali says, SplashActivity is not in the classes.dex either.

So it's getting nuked at the dexing stage? Why?

-ken
--
-----

Alexander Yakushev

unread,
Dec 26, 2015, 7:26:03 AM12/26/15
to clojure-android
Disable `--incremental` in `:dex-opts` in project.clj. Then run `DEBUG=1 lein droid create-dex`, look at the command that is executed to see any weirdness. Then paste&run that command into the terminal and inspect classes.dex with baksmali again.

Ken Restivo

unread,
Dec 28, 2015, 10:20:04 PM12/28/15
to clojure...@googlegroups.com
Weird. No errors from dx.

> Creating DEX....
> /usr/local/android/sdk-linux_x86/build-tools/23.0.2/dx -JXmx4096M --dex --output /tmp/foo/target/release /tmp/foo/target/release/mininified-classes.jar /usr/local/android/sdk-linux_x86/tools/support/annotations.jar

However, I opened up that mininified-classes.jar, and it turns out the SplashActivity was removed it by something, before dexing! So the problem is occurring between compiling and mininifiying, whatever that is.

So it is in fact looking like a proguard problem.

The only errors I see from that stage are:
> Copying resources from program jar [/home/lken/.m2/repository/neko/neko/4.0.0-alpha5/neko-4.0.0-alpha5.jar]
> Warning: can't write resource [META-INF/MANIFEST.MF] (Duplicate zip entry [neko-4.0.0-alpha5.jar:META-INF/MANIFEST.MF])

Also the command is:

> Running Proguard...
> /usr/local/android/sdk-linux_x86/tools/proguard/bin/proguard.sh @/tmp/foo/build/proguard-minify.cfg -injars /tmp/foo/target/release/classes:/home/lken/.m2/repository/tigris/tigris/0.1.1/tigris-0.1.1.jar:/home/lken/.m2/repository/org/timmc/handy/1.7.0/handy-1.7.0.jar:/home/lken/.m2/repository/neko/neko/4.0.0-alpha5/neko-4.0.0-alpha5.jar:/home/lken/.m2/repository/com/fasterxml/jackson/dataformat/jackson-dataformat-smile/2.5.3/jackson-dataformat-smile-2.5.3.jar:/home/lken/.m2/repository/com/android/support/support-annotations/21.0.0/support-annotations-21.0.0.jar:/home/lken/.m2/repository/cheshire/cheshire/5.5.0/cheshire-5.5.0.jar:/home/lken/.m2/repository/utilza/utilza/0.1.73/utilza-0.1.73.jar:/home/lken/.m2/repository/com/fasterxml/jackson/core/jackson-core/2.5.3/jackson-core-2.5.3.jar:/home/lken/.m2/repository/com/fasterxml/jackson/dataformat/jackson-dataformat-cbor/2.5.3/jackson-dataformat-cbor-2.5.3.jar:/home/lken/.m2/repository/org/skummet/clojure/1.7.0-r1/clojure-1.7.0-r1.jar:/tmp/foo/target/release/aar-extracted/com.android.support_support-v4_aar_21.0.0/classes.jar:/tmp/foo/target/release/aar-extracted/com.android.support_multidex_aar_1.0.0/classes.jar:/tmp/foo/target/release/aar-extracted/com.android.support_support-v4_aar_21.0.0/libs/internal_impl-21.0.0.jar -libraryjars /usr/local/android/sdk-linux_x86/tools/support/annotations.jar:/usr/local/android/sdk-linux_x86/platforms/android-18/android.jar -outjars /tmp/foo/target/release/mininified-classes.jar
> ProGuard, version 5.2.1


So. It's proguard causing trouble.

And.... sure enough proguard is discaring the classes.

And the problem is found and fixed:


> diff --git a/build/proguard-minify.cfg b/build/proguard-minify.cfg
> index 5d712a3..47fa795 100644
> --- a/build/proguard-minify.cfg
> +++ b/build/proguard-minify.cfg
> @@ -59,5 +59,5 @@
> -keep public class **__init
>
> --keep public class test.leindroid.sample.*
> +-keep public class my.damn.namespace.*
>
> # The support library contains references to newer platform versions.
> @@ -72,2 +72,3 @@
> -keep public class com.google.android.gms.* { public *; }
> -dontwarn com.google.android.gms.**
> +
>

When porting the app from old neko to new neko, I copied the proguard.cfg from the sample project.

And forgot to edit it to match the new app.

So, this app is finally going to be released to the Google Play store, exactly 2 years later.

Thanks for your help, and thanks for lein-droid and neko!

-ken
--
--------

Alexander Yakushev

unread,
Dec 29, 2015, 5:20:31 AM12/29/15
to clojure-android
OK, I'm glad you found the problem. I was confused from the start because you've said that:


It's not proguard, because after setting proguard-execute to false, still the SplashActivity isn't there.

But it turned out to be proguard after all.
> To unsubscribe from this group and stop receiving emails from it, send an email to clojure-android+unsubscribe@googlegroups.com.
> To post to this group, send email to clojure-android@googlegroups.com.

Ken Restivo

unread,
Dec 30, 2015, 12:18:46 AM12/30/15
to clojure...@googlegroups.com
That confused me too. But the cause was clear enough once found.

Thanks again for your help, and thanks again for lein-droid and neko!

-ken
--
------
> > an email to clojure-andro...@googlegroups.com.
> > > To post to this group, send email to clojure...@googlegroups.com.
> > > Visit this group at https://groups.google.com/group/clojure-android.
> > > For more options, visit https://groups.google.com/d/optout.
> >
> >
>
> --
> You received this message because you are subscribed to the Google Groups "clojure-android" group.
> To unsubscribe from this group and stop receiving emails from it, send an email to clojure-andro...@googlegroups.com.
> To post to this group, send email to clojure...@googlegroups.com.
Reply all
Reply to author
Forward
0 new messages