Proguard混淆不起作用

时间:2014-06-26 07:07:39

标签: android obfuscation proguard

我正在尝试模糊我的包名,包括我使用过的库之一。

我在gradle文件中使用此构建配置:

buildTypes {
    debug {
        versionNameSuffix "-Development"
        debuggable true
        runProguard true
        proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
    }
    #...

这是我的proguard文件:

# Butterknife
-dontwarn butterknife.internal.**
-keep class **$$ViewInjector { *; }
-keepnames class * { @butterknife.InjectView *;}

# OrmLite uses reflection
-keepclassmembers class com.j256.** { *; }
-keep class my.package.name.database.** { *; }
-keep class com.j256.**

#test
-repackageclasses 'qqq1'
-flattenpackagehierarchy 'qqq2'
-allowaccessmodification
-forceprocessing

我正在使用此命令转储所有dexed类:

7z x -aoa my.apk classes.dex && dexdump classes.dex | grep "Class desc" | less

如果我只是grep for “qqq”,我仍然会看到所有完整的软件包名称我没有得到任何结果,所以似乎repackageclassesflattenpackagehierarchy这两个规则似乎都是忽略(我也测试过只使用其中一行)。知道我错过了什么吗?

2 个答案:

答案 0 :(得分:1)

对于库模块,构建系统似乎默认添加“-keeppackagenames”,这将导致包名称不被混淆。

您可以尝试使用此替代方法:

Add "-keeppackagenames !**" to disable -keeppackagenames being injected by the build system.

通过:https://code.google.com/p/android/issues/detail?id=67587

答案 1 :(得分:1)

哇这需要很长时间才能解决。奶油刀规则打破了一切。我的解决方案是从主页上抓一个,以及一切如何按预期工作。

以下是固定规则:

Unfolding Map v0.9.7 (UCSD edition)
Using OpenGLMapDisplay with processing.opengl.PGraphics2D
java.net.ConnectException: Connection timed out: connect
    at java.net.TwoStacksPlainSocketImpl.socketConnect(Native Method)
    at java.net.AbstractPlainSocketImpl.doConnect(AbstractPlainSocketImpl.java:350)
    at java.net.AbstractPlainSocketImpl.connectToAddress(AbstractPlainSocketImpl.java:206)
    at java.net.AbstractPlainSocketImpl.connect(AbstractPlainSocketImpl.java:188)
    at java.net.PlainSocketImpl.connect(PlainSocketImpl.java:172)
    at java.net.SocksSocketImpl.connect(SocksSocketImpl.java:392)
    at java.net.Socket.connect(Socket.java:589)
    at java.net.Socket.connect(Socket.java:538)
    at sun.net.NetworkClient.doConnect(NetworkClient.java:180)
    at sun.net.www.http.HttpClient.openServer(HttpClient.java:432)
    at sun.net.www.http.HttpClient.openServer(HttpClient.java:527)
    at sun.net.www.http.HttpClient.<init>(HttpClient.java:211)
    at sun.net.www.http.HttpClient.New(HttpClient.java:308)
    at sun.net.www.http.HttpClient.New(HttpClient.java:326)
    at sun.net.www.protocol.http.HttpURLConnection.getNewHttpClient(HttpURLConnection.java:1169)
    at sun.net.www.protocol.http.HttpURLConnection.plainConnect0(HttpURLConnection.java:1105)
    at sun.net.www.protocol.http.HttpURLConnection$6.run(HttpURLConnection.java:989)
    at sun.net.www.protocol.http.HttpURLConnection$6.run(HttpURLConnection.java:987)
    at java.security.AccessController.doPrivileged(Native Method)
    at java.security.AccessController.doPrivilegedWithCombiner(AccessController.java:782)
    at sun.net.www.protocol.http.HttpURLConnection.plainConnect(HttpURLConnection.java:986)
    at sun.net.www.protocol.http.HttpURLConnection.connect(HttpURLConnection.java:933)
    at sun.net.www.protocol.http.HttpURLConnection.getInputStream0(HttpURLConnection.java:1513)
    at sun.net.www.protocol.http.HttpURLConnection.access$200(HttpURLConnection.java:90)
    at sun.net.www.protocol.http.HttpURLConnection$9.run(HttpURLConnection.java:1433)
    at sun.net.www.protocol.http.HttpURLConnection$9.run(HttpURLConnection.java:1431)
    at java.security.AccessController.doPrivileged(Native Method)
    at java.security.AccessController.doPrivilegedWithCombiner(AccessController.java:782)
    at sun.net.www.protocol.http.HttpURLConnection.getInputStream(HttpURLConnection.java:1430)
    at java.net.URL.openStream(URL.java:1038)
    at processing.core.PApplet.createInputRaw(PApplet.java:7267)
    at processing.core.PApplet.createInput(PApplet.java:7235)
    at processing.core.PApplet.loadBytes(PApplet.java:7462)
    at processing.core.PApplet.loadImage(PApplet.java:5879)
    at de.fhpotsdam.unfolding.tiles.TileLoader.getTileFromUrl(Unknown Source)
    at de.fhpotsdam.unfolding.tiles.TileLoader.run(Unknown Source)
    at java.lang.Thread.run(Thread.java:745)
java.net.ConnectException: Connection timed out: connect
    at java.net.TwoStacksPlainSocketImpl.socketConnect(Native Method)
    at java.net.AbstractPlainSocketImpl.doConnect(AbstractPlainSocketImpl.java:350)
    at java.net.AbstractPlainSocketImpl.connectToAddress(AbstractPlainSocketImpl.java:206)
    at java.net.AbstractPlainSocketImpl.connect(AbstractPlainSocketImpl.java:188)
    at java.net.PlainSocketImpl.connect(PlainSocketImpl.java:172)
    at java.net.SocksSocketImpl.connect(SocksSocketImpl.java:392)
    at java.net.Socket.connect(Socket.java:589)
    at java.net.Socket.connect(Socket.java:538)
    at sun.net.NetworkClient.doConnect(NetworkClient.java:180)
    at sun.net.www.http.HttpClient.openServer(HttpClient.java:432)
    at sun.net.www.http.HttpClient.openServer(HttpClient.java:527)
    at sun.net.www.http.HttpClient.<init>(HttpClient.java:211)
    at sun.net.www.http.HttpClient.New(HttpClient.java:308)
    at sun.net.www.http.HttpClient.New(HttpClient.java:326)
    at sun.net.www.protocol.http.HttpURLConnection.getNewHttpClient(HttpURLConnection.java:1169)
    at sun.net.www.protocol.http.HttpURLConnection.plainConnect0(HttpURLConnection.java:1105)
    at sun.net.www.protocol.http.HttpURLConnection$6.run(HttpURLConnection.java:989)
    at sun.net.www.protocol.http.HttpURLConnection$6.run(HttpURLConnection.java:987)
    at java.security.AccessController.doPrivileged(Native Method)
    at java.security.AccessController.doPrivilegedWithCombiner(AccessController.java:782)
    at sun.net.www.protocol.http.HttpURLConnection.plainConnect(HttpURLConnection.java:986)
    at sun.net.www.protocol.http.HttpURLConnection.connect(HttpURLConnection.java:933)
    at sun.net.www.protocol.http.HttpURLConnection.getInputStream0(HttpURLConnection.java:1513)
    at sun.net.www.protocol.http.HttpURLConnection.access$200(HttpURLConnection.java:90)
    at sun.net.www.protocol.http.HttpURLConnection$9.run(HttpURLConnection.java:1433)
    at sun.net.www.protocol.http.HttpURLConnection$9.run(HttpURLConnection.java:1431)
    at java.security.AccessController.doPrivileged(Native Method)
    at java.security.AccessController.doPrivilegedWithCombiner(AccessController.java:782)
    at sun.net.www.protocol.http.HttpURLConnection.getInputStream(HttpURLConnection.java:1430)
    at java.net.URL.openStream(URL.java:1038)
    at processing.core.PApplet.createInputRaw(PApplet.java:7267)
    at processing.core.PApplet.createInput(PApplet.java:7235)
    at processing.core.PApplet.loadBytes(PApplet.java:7462)
    at processing.core.PApplet.loadImage(PApplet.java:5879)
    at de.fhpotsdam.unfolding.tiles.TileLoader.getTileFromUrl(Unknown Source)
    at de.fhpotsdam.unfolding.tiles.TileLoader.run(Unknown Source)
    at java.lang.Thread.run(Thread.java:745)
The file "http://mt1.google.com/vt/v=w2p.116&hl=de&x=178&y=413&z=10&s=Galileo" is missing or inaccessible, make sure the URL is valid or that the file has been added to your sketch and is readable.
java.net.ConnectException: Connection timed out: connect
    at java.net.TwoStacksPlainSocketImpl.socketConnect(Native Method)
    at java.net.AbstractPlainSocketImpl.doConnect(AbstractPlainSocketImpl.java:350)
    at java.net.AbstractPlainSocketImpl.connectToAddress(AbstractPlainSocketImpl.java:206)
    at java.net.AbstractPlainSocketImpl.connect(AbstractPlainSocketImpl.java:188)
    at java.net.PlainSocketImpl.connect(PlainSocketImpl.java:172)
    at java.net.SocksSocketImpl.connect(SocksSocketImpl.java:392)
    at java.net.Socket.connect(Socket.java:589)
    at java.net.Socket.connect(Socket.java:538)
    at sun.net.NetworkClient.doConnect(NetworkClient.java:180)
    at sun.net.www.http.HttpClient.openServer(HttpClient.java:432)
    at sun.net.www.http.HttpClient.openServer(HttpClient.java:527)
    at sun.net.www.http.HttpClient.<init>(HttpClient.java:211)
    at sun.net.www.http.HttpClient.New(HttpClient.java:308)
    at sun.net.www.http.HttpClient.New(HttpClient.java:326)
    at sun.net.www.protocol.http.HttpURLConnection.getNewHttpClient(HttpURLConnection.java:1169)
    at sun.net.www.protocol.http.HttpURLConnection.plainConnect0(HttpURLConnection.java:1105)
    at sun.net.www.protocol.http.HttpURLConnection$6.run(HttpURLConnection.java:989)
    at sun.net.www.protocol.http.HttpURLConnection$6.run(HttpURLConnection.java:987)
    at java.security.AccessController.doPrivileged(Native Method)
    at java.security.AccessController.doPrivilegedWithCombiner(AccessController.java:782)
    at sun.net.www.protocol.http.HttpURLConnection.plainConnect(HttpURLConnection.java:986)
    at sun.net.www.protocol.http.HttpURLConnection.connect(HttpURLConnection.java:933)
    at sun.net.www.protocol.http.HttpURLConnection.getInputStream0(HttpURLConnection.java:1513)
    at sun.net.www.protocol.http.HttpURLConnection.access$200(HttpURLConnection.java:90)
    at sun.net.www.protocol.http.HttpURLConnection$9.run(HttpURLConnection.java:1433)
    at sun.net.www.protocol.http.HttpURLConnection$9.run(HttpURLConnection.java:1431)
    at java.security.AccessController.doPrivileged(Native Method)
    at java.security.AccessController.doPrivilegedWithCombiner(AccessController.java:782)
    at sun.net.www.protocol.http.HttpURLConnection.getInputStream(HttpURLConnection.java:1430)
    at java.net.URL.openStream(URL.java:1038)
    at processing.core.PApplet.createInputRaw(PApplet.java:7267)
    at processing.core.PApplet.createInput(PApplet.java:7235)
    at processing.core.PApplet.loadBytes(PApplet.java:7462)
    at processing.core.PApplet.loadImage(PApplet.java:5879)
    at de.fhpotsdam.unfolding.tiles.TileLoader.getTileFromUrl(Unknown Source)
    at de.fhpotsdam.unfolding.tiles.TileLoader.run(Unknown Source)
    at java.lang.Thread.run(Thread.java:745)
java.net.ConnectException: Connection timed out: connect
    at java.net.TwoStacksPlainSocketImpl.socketConnect(Native Method)
    at java.net.AbstractPlainSocketImpl.doConnect(AbstractPlainSocketImpl.java:350)
    at java.net.AbstractPlainSocketImpl.connectToAddress(AbstractPlainSocketImpl.java:206)
    at java.net.AbstractPlainSocketImpl.connect(AbstractPlainSocketImpl.java:188)
    at java.net.PlainSocketImpl.connect(PlainSocketImpl.java:172)
    at java.net.SocksSocketImpl.connect(SocksSocketImpl.java:392)
    at java.net.Socket.connect(Socket.java:589)
    at java.net.Socket.connect(Socket.java:538)
    at sun.net.NetworkClient.doConnect(NetworkClient.java:180)
    at sun.net.www.http.HttpClient.openServer(HttpClient.java:432)
    at sun.net.www.http.HttpClient.openServer(HttpClient.java:527)
    at sun.net.www.http.HttpClient.<init>(HttpClient.java:211)
    at sun.net.www.http.HttpClient.New(HttpClient.java:308)
    at sun.net.www.http.HttpClient.New(HttpClient.java:326)
    at sun.net.www.protocol.http.HttpURLConnection.getNewHttpClient(HttpURLConnection.java:1169)
    at sun.net.www.protocol.http.HttpURLConnection.plainConnect0(HttpURLConnection.java:1105)
    at sun.net.www.protocol.http.HttpURLConnection$6.run(HttpURLConnection.java:989)
    at sun.net.www.protocol.http.HttpURLConnection$6.run(HttpURLConnection.java:987)
    at java.security.AccessController.doPrivileged(Native Method)
    at java.security.AccessController.doPrivilegedWithCombiner(AccessController.java:782)
    at sun.net.www.protocol.http.HttpURLConnection.plainConnect(HttpURLConnection.java:986)
    at sun.net.www.protocol.http.HttpURLConnection.connect(HttpURLConnection.java:933)
    at sun.net.www.protocol.http.HttpURLConnection.getInputStream0(HttpURLConnection.java:1513)
    at sun.net.www.protocol.http.HttpURLConnection.access$200(HttpURLConnection.java:90)
    at sun.net.www.protocol.http.HttpURLConnection$9.run(HttpURLConnection.java:1433)
    at sun.net.www.protocol.http.HttpURLConnection$9.run(HttpURLConnection.java:1431)
    at java.security.AccessController.doPrivileged(Native Method)
    at java.security.AccessController.doPrivilegedWithCombiner(AccessController.java:782)
    at sun.net.www.protocol.http.HttpURLConnection.getInputStream(HttpURLConnection.java:1430)
    at java.net.URL.openStream(URL.java:1038)
    at processing.core.PApplet.createInputRaw(PApplet.java:7267)
    at processing.core.PApplet.createInput(PApplet.java:7235)
    at processing.core.PApplet.loadBytes(PApplet.java:7462)
    at processing.core.PApplet.loadImage(PApplet.java:5879)
    at de.fhpotsdam.unfolding.tiles.TileLoader.getTileFromUrl(Unknown Source)
    at de.fhpotsdam.unfolding.tiles.TileLoader.run(Unknown Source)
    at java.lang.Thread.run(Thread.java:745)
The file "http://mt1.google.com/vt/v=w2p.116&hl=de&x=177&y=412&z=10&s=Galileo" is missing or inaccessible, make sure the URL is valid or that the file has been added to your sketch and is readable.
The file "http://mt1.google.com/vt/v=w2p.116&hl=de&x=178&y=411&z=10&s=Galileo" is missing or inaccessible, make sure the URL is valid or that the file has been added to your sketch and is readable.
The file "http://mt1.google.com/vt/v=w2p.116&hl=de&x=178&y=412&z=10&s=Galileo" is missing or inaccessible, make sure the URL is valid or that the file has been added to your sketch and is readable.
Picked up _JAVA_OPTIONS: -Djava.net.preferIPv4Stack=true