关于ProGuard for Android的新文档说,要在项目主目录的default.properties文件中添加一行.但是,在打开此文件时,我在顶部阅读:
# This file is automatically generated by Android Tools.
# Do not modify this file -- YOUR CHANGES WILL BE ERASED!
Run Code Online (Sandbox Code Playgroud)
我错过了什么吗?
另外,有没有办法让ProGuard仅用于Eclipse的生产构建(即,在导出成品时)?
我配置了:
-keep ,allowoptimization,allowobfuscation,allowshrinking public class org.jf.dexlib2.dexbacked.** {
*;
}
Run Code Online (Sandbox Code Playgroud)
但仍然收到警告:
Note: the configuration keeps the entry point 'com.trusteer.trf.dex_parser { int get_strings_count(org.jf.dexlib2.dexbacked.DexBackedDexFile); }', but not the descriptor class 'org.jf.dexlib2.dexbacked.DexBackedDexFile'
Run Code Online (Sandbox Code Playgroud)
我使用的是proguard 4.7版(在Android SDK中)
我该怎么办?
我在这里的时间很短,所以我真的希望这里有人知道如何解决这些问题:
[proguard] Warning: android.support.v4.view.ViewConfigurationCompatFroyo: can't find referenced method 'int getScaledPagingTouchSlop()' in class android.view.ViewConfiguration
[proguard] Note: org.codehaus.jackson.map.deser.BasicDeserializerFactory: can't find dynamically referenced class java.util.ConcurrentNavigableMap
[proguard] Note: org.codehaus.jackson.map.deser.BasicDeserializerFactory: can't find dynamically referenced class java.util.ConcurrentSkipListMap
[proguard] Note: there were 2 unresolved dynamic references to classes or interfaces.
[proguard] You should check if you need to specify additional program jars.
[proguard] Warning: there were 1 unresolved references to program class members.
[proguard] Your input classes appear to be inconsistent.
[proguard] You may need to recompile …Run Code Online (Sandbox Code Playgroud) 我试图通过将以下内容添加到文件〜/ .bashrc来扩展我的$ PATH变量在git bash(MinGW shell)中
PATH=$PATH':/c/Program Files/maven/apache-maven-3.2.5/bin'
Run Code Online (Sandbox Code Playgroud)
在我这样做并重新启动bash后,似乎$ PATH变量被扩展为预期:
$ echo $PATH
MANY_OTHER_PATHS:/c/Program Files/maven/apache-maven-3.2.5/bin
Run Code Online (Sandbox Code Playgroud)
但我仍然无法在给定目录中执行程序:
$ mvn
bash: mvn: command not found
Run Code Online (Sandbox Code Playgroud)
这里出了什么问题?如何正确扩展PATH变量?
我试图在我的Android应用程序上运行Proguard并遇到问题.
我正在使用SpongyCastle jar(复制和过去的完整充气城堡与包重命名,所以它不与版本中建立的机器人充气城堡冲突)
运行proguard时,我看到以下内容
我该如何解决?将rt.jar添加到我的库中?
proguard的重点是缩小代码,但我不断添加jar来解决这些问题,其中proguard抱怨它无法找到一个类!我错过了什么吗?
[proguard] Warning: org.spongycastle.x509.util.LDAPStoreHelper: can't find referenced class javax.naming.directory.InitialDirContext
[proguard] Warning: org.spongycastle.x509.util.LDAPStoreHelper: can't find referenced class javax.naming.directory.InitialDirContext
[proguard] Warning: org.spongycastle.x509.util.LDAPStoreHelper: can't find referenced class javax.naming.directory.SearchControls
[proguard] Warning: org.spongycastle.x509.util.LDAPStoreHelper: can't find referenced class javax.naming.directory.SearchControls
[proguard] Warning: org.spongycastle.x509.util.LDAPStoreHelper: can't find referenced class javax.naming.directory.SearchControls
[proguard] Warning: org.spongycastle.x509.util.LDAPStoreHelper: can't find referenced class javax.naming.directory.SearchControls
[proguard] Warning: org.spongycastle.x509.util.LDAPStoreHelper: can't find referenced class javax.naming.directory.SearchControls
[proguard] Warning: org.spongycastle.x509.util.LDAPStoreHelper: can't find referenced class javax.naming.directory.DirContext
[proguard] Warning: org.spongycastle.x509.util.LDAPStoreHelper: can't find referenced class javax.naming.NamingEnumeration
[proguard] Warning: …Run Code Online (Sandbox Code Playgroud) 我是Spring Boot的新手,尝试使用spring初始值设定项在intellij中构建我的第一个Spring Boot项目(Maven)时,在创建项目后运行项目时出现此错误:
无法访问org.springframework.context.ConfigurableApplicationContext的org.springframework.context.ConfigurableApplicationContext类文件
我遵循了许多教程,但是每次遇到此错误时,如何解决此问题?
我的pom.xml文件:
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0
http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>com.boot</groupId>
<artifactId>das-boot</artifactId>
<version>0.0.1-SNAPSHOT</version>
<packaging>jar</packaging>
<name>First spring boot app</name>
<description>project for Spring Boot</description>
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>1.4.0.RELEASE</version>
<relativePath /> <!-- lookup parent from repository -->
</parent>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
<java.version>1.8</java.version>
</properties>
<dependencies>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-test</artifactId>
<scope>test</scope>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
</plugin>
</plugins>
</build>
</project>
Run Code Online (Sandbox Code Playgroud) 考虑这个proguard语句:
-keep public class * extends android.support.design.widget.CoordinatorLayout$Behavior { *; }
Run Code Online (Sandbox Code Playgroud)
在这个声明中添加{*; } 意思?
它保留所有方法吗?所有领域?还是整个班级?
我正在使用Apache Commons 1.4.1库来压缩和解压缩".tar.gz"文件.
我在最后一点遇到麻烦 - 将a转换TarArchiveInputStream成a FileOutputStream.
奇怪的是,它在这条线上打破了:
FileOutputStream fout = new FileOutputStream(destPath);
Run Code Online (Sandbox Code Playgroud)
destPath 是一个具有Canonical路径的文件:C:\ Documents and Settings\Administrator\My Documents\JavaWorkspace\BackupUtility\untarred\Test\subdir\testinsub.txt
出错:
Exception in thread "main" java.io.IOException: The system cannot find the path specified
Run Code Online (Sandbox Code Playgroud)
知道它可能是什么?为什么它无法找到路径?
我正在附上下面的整个方法(其中大部分是从这里解除的).
private void untar(File dest) throws IOException {
dest.mkdir();
TarArchiveEntry tarEntry = tarIn.getNextTarEntry();
// tarIn is a TarArchiveInputStream
while (tarEntry != null) {// create a file with the same name as the tarEntry
File destPath = new File(dest.toString() + System.getProperty("file.separator") …Run Code Online (Sandbox Code Playgroud) 在proguard.cfg中排除父包后,如何包含某些包:
例如:
-keep com.myapp.**{*; }
我想要proguard来混淆com.myapp.data.**{*; }
任何人都可以指出(或提供?)一些很好的,明确的如何在Win32中实现滚动的例子?显然,谷歌提出了很多东西,但大多数例子对我来说似乎太简单或太复杂,无法确保他们能够证明正确的做事方式.我在当前项目中使用LispWorks CAPI(跨平台Common Lisp GUI库),在Windows上我有一个难以弄清楚的与滚动相关的错误; 基本上我想通过Win32 API直接做一些测试,看看我是否可以对这种情况有所了解.
非常感谢,克里斯托弗
一直在和Proguard一起战斗,并在官方的Proguard网站和StackOverflow上尝试了很多示例和解决方案.
我有一个需要混淆的大型项目,它有许多引用的库项目和Jars.
我从2个libs,com.google.common和twitter4j收到来自proguard的725个警告.
如果我添加以下内容,我很乐意让项目编译:
-dontwarn com.google.common.**
-dontwarn twitter4j.**
Run Code Online (Sandbox Code Playgroud)
然而,应用程序在打开时立即崩溃,所以这似乎只是一种隐藏问题的方式,而不是修复它.
proguard-project.txt位于项目根目录中,其配置位于project.properties文件中,如下所示.
proguard.config=${sdk.dir}/tools/proguard/proguard-android.txt:proguard-project.txt
Run Code Online (Sandbox Code Playgroud)
这是我的proguard-project.txt文件
-optimizationpasses 5
-dontusemixedcaseclassnames
-dontskipnonpubliclibraryclasses
-dontpreverify
-verbose
-dontshrink
-optimizations !code/simplification/arithmetic,!field/*,!class/merging/*
-keep public class * extends android.app.Activity
-keep public class * extends android.app.Application
-keep public class * extends android.app.Service
-keep public class * extends android.content.BroadcastReceiver
-keep public class * extends android.content.ContentProvider
-keep public class * extends android.app.backup.BackupAgentHelper
-keep public class * extends android.preference.Preference
-keep public class com.android.vending.licensing.ILicensingService
-keep class javax.** { *; }
-keep class org.** { *; }
-keep …Run Code Online (Sandbox Code Playgroud) 我为我的Android应用程序启用了proguard.我可以成功构建项目,但它在启动时崩溃与classNotFoundException.它甚至没有找到发射器活动.这是我的proguard规则文件
-libraryjars libs
-keep public class * extends android.app.Activity
-keep public class * extends android.app.Application
-keepnames class com.mypackage.** { *; } //someone suggested this but doesn't work
# We only want obfuscation
-keepattributes InnerClasses,Signature
# Sdk
-keep public interface com.zendesk.sdk.** { *; }
-keep public class com.zendesk.sdk.** { *; }
# Appcompat and support
-keep interface android.support.v7.** { *; }
-keep class android.support.v7.** { *; }
-keep interface android.support.v4.** { *; }
-keep class android.support.v4.** { *; }
# Gson …Run Code Online (Sandbox Code Playgroud) 在使用符号加密然后解密和验证时,我在验证时不断在流中获取未知对象。消息完整性检查已通过,但是当我尝试在解密后的下一行进行验证时,出现上述错误。
private static void encryptFile(
String outFileName,
OutputStream out,
String fileName,
PGPPublicKey encKey,
String sKeyFileName,
char[] passPhrase,
boolean armor,
boolean withIntegrityCheck)
throws Exception
{
if (armor)
{
out = new ArmoredOutputStream(out);
}
try
{
byte[] bytes = PGPKeyUtil.compressFile(fileName, CompressionAlgorithmTags.ZIP);
PGPEncryptedDataGenerator encGen = new PGPEncryptedDataGenerator(
PGPEncryptedData.CAST5, withIntegrityCheck, new SecureRandom(), "BC");
encGen.addMethod(encKey);
OutputStream cOut = encGen.open(out, bytes.length);
cOut.write(bytes);
cOut.close();
out.close();
cOut.close();
if (armor)
{
out.close();
}
encGen.close();
}
catch (PGPException e)
{
System.err.println(e);
if (e.getUnderlyingException() != null)
{
e.getUnderlyingException().printStackTrace();
}
}
} …Run Code Online (Sandbox Code Playgroud) android ×8
obfuscation ×8
proguard ×8
java ×4
bouncycastle ×1
compression ×1
eclipse ×1
encryption ×1
file-io ×1
git-bash ×1
maven ×1
mingw ×1
path ×1
pgp ×1
scroll ×1
sign ×1
spring-boot ×1
sqlcipher ×1
tar ×1
win32gui ×1
winapi ×1