Форум программистов, компьютерный форум CyberForum.ru
Наши страницы

Программирование Android

Войти
Регистрация
Восстановить пароль
 
lepestok198344
0 / 0 / 0
Регистрация: 02.07.2014
Сообщений: 5
#1

Внешние библиотеки, компиляция с proguard - Программирование Android

31.01.2015, 23:39. Просмотров 409. Ответов 0
Метки нет (Все метки)

Решил защитить код приложения, но никак не могу добиться нормальной компиляции вместе с proguard на eclipse.
В приложении есть подключаемые библиотеки. Содержимое папки Libs
google-play-services_lib\
slidingmenu\
mail.jar
jsoup-1.8.1.jar
activation.jar
additionnal.jar
в итоге получаю следующие ошибки

XML
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
[2015-01-31 22:51:01 - Myapp] Proguard returned with error code 1. See console
[2015-01-31 22:51:01 - Myapp] Warning: class [google-play-services_lib/bin/classes/android/UnusedStub.class] unexpectedly contains class [android.UnusedStub]
[2015-01-31 22:51:01 - Myapp] Warning: class [google-play-services_lib/bin/classes/com/google/android/gms/BuildConfig.class] unexpectedly contains class [com.google.android.gms.BuildConfig]
[2015-01-31 22:51:01 - Myapp] Warning: class [google-play-services_lib/bin/classes/com/google/android/gms/R$attr.class] unexpectedly contains class [com.google.android.gms.R$attr]
[2015-01-31 22:51:01 - Myapp] Warning: class [google-play-services_lib/bin/classes/com/google/android/gms/R$color.class] unexpectedly contains class [com.google.android.gms.R$color]
[2015-01-31 22:51:01 - Myapp] Warning: class [google-play-services_lib/bin/classes/com/google/android/gms/R$drawable.class] unexpectedly contains class [com.google.android.gms.R$drawable]
[2015-01-31 22:51:01 - Myapp] Warning: class [google-play-services_lib/bin/classes/com/google/android/gms/R$styleable.class] unexpectedly contains class [com.google.android.gms.R$styleable]
[2015-01-31 22:51:01 - Myapp] Warning: class [google-play-services_lib/bin/classes/com/google/android/gms/R.class] unexpectedly contains class [com.google.android.gms.R]
[2015-01-31 22:51:01 - Myapp] Warning: class [slidingmenu/bin/classes/com/jeremyfeinstein/slidingmenu/lib/app/SlidingActivity.class] unexpectedly contains class [com.jeremyfeinstein.slidingmenu.lib.app.SlidingActivity]
[2015-01-31 22:51:01 - Myapp] Warning: class [slidingmenu/bin/classes/com/jeremyfeinstein/slidingmenu/lib/app/SlidingActivityBase.class] unexpectedly contains class [com.jeremyfeinstein.slidingmenu.lib.app.SlidingActivityBase]
[2015-01-31 22:51:01 - Myapp] Warning: class [slidingmenu/bin/classes/com/jeremyfeinstein/slidingmenu/lib/app/SlidingActivityHelper$1.class] unexpectedly contains class [com.jeremyfeinstein.slidingmenu.lib.app.SlidingActivityHelper$1]
[2015-01-31 22:51:01 - Myapp] Warning: class [slidingmenu/bin/classes/com/jeremyfeinstein/slidingmenu/lib/app/SlidingActivityHelper.class] unexpectedly contains class [com.jeremyfeinstein.slidingmenu.lib.app.SlidingActivityHelper]
[2015-01-31 22:51:01 - Myapp] Warning: class [slidingmenu/bin/classes/com/jeremyfeinstein/slidingmenu/lib/CanvasTransformerBuilder$1.class] unexpectedly contains class [com.jeremyfeinstein.slidingmenu.lib.CanvasTransformerBuilder$1]
[2015-01-31 22:51:01 - Myapp] Warning: class [slidingmenu/bin/classes/com/jeremyfeinstein/slidingmenu/lib/CanvasTransformerBuilder$2.class] unexpectedly contains class [com.jeremyfeinstein.slidingmenu.lib.CanvasTransformerBuilder$2]
[2015-01-31 22:51:01 - Myapp] Warning: class [slidingmenu/bin/classes/com/jeremyfeinstein/slidingmenu/lib/CanvasTransformerBuilder$3.class] unexpectedly contains class [com.jeremyfeinstein.slidingmenu.lib.CanvasTransformerBuilder$3]
[2015-01-31 22:51:01 - Myapp] Warning: class [slidingmenu/bin/classes/com/jeremyfeinstein/slidingmenu/lib/CanvasTransformerBuilder$4.class] unexpectedly contains class [com.jeremyfeinstein.slidingmenu.lib.CanvasTransformerBuilder$4]
[2015-01-31 22:51:01 - Myapp] Warning: class [slidingmenu/bin/classes/com/jeremyfeinstein/slidingmenu/lib/CanvasTransformerBuilder$5.class] unexpectedly contains class [com.jeremyfeinstein.slidingmenu.lib.CanvasTransformerBuilder$5]
[2015-01-31 22:51:01 - Myapp] Warning: class [slidingmenu/bin/classes/com/jeremyfeinstein/slidingmenu/lib/CanvasTransformerBuilder$6.class] unexpectedly contains class [com.jeremyfeinstein.slidingmenu.lib.CanvasTransformerBuilder$6]
[2015-01-31 22:51:01 - Myapp] Warning: class [slidingmenu/bin/classes/com/jeremyfeinstein/slidingmenu/lib/CanvasTransformerBuilder.class] unexpectedly contains class [com.jeremyfeinstein.slidingmenu.lib.CanvasTransformerBuilder]
[2015-01-31 22:51:01 - Myapp] Warning: class [slidingmenu/bin/classes/com/jeremyfeinstein/slidingmenu/lib/CustomViewBehind.class] unexpectedly contains class [com.jeremyfeinstein.slidingmenu.lib.CustomViewBehind]
[2015-01-31 22:51:01 - Myapp] Warning: class [slidingmenu/bin/classes/com/jeremyfeinstein/slidingmenu/lib/MenuInterface.class] unexpectedly contains class [com.jeremyfeinstein.slidingmenu.lib.MenuInterface]
[2015-01-31 22:51:01 - Myapp] Warning: class [slidingmenu/bin/classes/com/jeremyfeinstein/slidingmenu/lib/R$attr.class] unexpectedly contains class [com.jeremyfeinstein.slidingmenu.lib.R$attr]
[2015-01-31 22:51:01 - Myapp] Warning: class [slidingmenu/bin/classes/com/jeremyfeinstein/slidingmenu/lib/R$id.class] unexpectedly contains class [com.jeremyfeinstein.slidingmenu.lib.R$id]
[2015-01-31 22:51:01 - Myapp] Warning: class [slidingmenu/bin/classes/com/jeremyfeinstein/slidingmenu/lib/R$layout.class] unexpectedly contains class [com.jeremyfeinstein.slidingmenu.lib.R$layout]
[2015-01-31 22:51:01 - Myapp] Warning: class [slidingmenu/bin/classes/com/jeremyfeinstein/slidingmenu/lib/R$styleable.class] unexpectedly contains class [com.jeremyfeinstein.slidingmenu.lib.R$styleable]
[2015-01-31 22:51:01 - Myapp] Warning: class [slidingmenu/bin/classes/com/jeremyfeinstein/slidingmenu/lib/R.class] unexpectedly contains class [com.jeremyfeinstein.slidingmenu.lib.R]
[2015-01-31 22:51:01 - Myapp] Warning: class [slidingmenu/bin/classes/com/jeremyfeinstein/slidingmenu/lib/SlidingMenu$1.class] unexpectedly contains class [com.jeremyfeinstein.slidingmenu.lib.SlidingMenu$1]
[2015-01-31 22:51:01 - Myapp] Warning: class [slidingmenu/bin/classes/com/jeremyfeinstein/slidingmenu/lib/SlidingMenu$2.class] unexpectedly contains class [com.jeremyfeinstein.slidingmenu.lib.SlidingMenu$2]
[2015-01-31 22:51:01 - Myapp] Warning: class [slidingmenu/bin/classes/com/jeremyfeinstein/slidingmenu/lib/SlidingMenu$CanvasTransformer.class] unexpectedly contains class [com.jeremyfeinstein.slidingmenu.lib.SlidingMenu$CanvasTransformer]
[2015-01-31 22:51:01 - Myapp] Warning: class [slidingmenu/bin/classes/com/jeremyfeinstein/slidingmenu/lib/SlidingMenu$OnClosedListener.class] unexpectedly contains class [com.jeremyfeinstein.slidingmenu.lib.SlidingMenu$OnClosedListener]
[2015-01-31 22:51:01 - Myapp] Warning: class [slidingmenu/bin/classes/com/jeremyfeinstein/slidingmenu/lib/SlidingMenu$OnCloseListener.class] unexpectedly contains class [com.jeremyfeinstein.slidingmenu.lib.SlidingMenu$OnCloseListener]
[2015-01-31 22:51:01 - Myapp] Warning: class [slidingmenu/bin/classes/com/jeremyfeinstein/slidingmenu/lib/SlidingMenu$OnOpenedListener.class] unexpectedly contains class [com.jeremyfeinstein.slidingmenu.lib.SlidingMenu$OnOpenedListener]
[2015-01-31 22:51:01 - Myapp] Warning: class [slidingmenu/bin/classes/com/jeremyfeinstein/slidingmenu/lib/SlidingMenu$OnOpenListener.class] unexpectedly contains class [com.jeremyfeinstein.slidingmenu.lib.SlidingMenu$OnOpenListener]
[2015-01-31 22:51:01 - Myapp] Warning: class [slidingmenu/bin/classes/com/jeremyfeinstein/slidingmenu/lib/SlidingMenu$SavedState$1.class] unexpectedly contains class [com.jeremyfeinstein.slidingmenu.lib.SlidingMenu$SavedState$1]
[2015-01-31 22:51:01 - Myapp] Warning: class [slidingmenu/bin/classes/com/jeremyfeinstein/slidingmenu/lib/SlidingMenu$SavedState.class] unexpectedly contains class [com.jeremyfeinstein.slidingmenu.lib.SlidingMenu$SavedState]
[2015-01-31 22:51:01 - Myapp] Warning: class [slidingmenu/bin/classes/com/jeremyfeinstein/slidingmenu/lib/SlidingMenu.class] unexpectedly contains class [com.jeremyfeinstein.slidingmenu.lib.SlidingMenu]
[2015-01-31 22:51:01 - Myapp] Warning: class [bin/classes/android/UnusedStub.class] unexpectedly contains class [android.UnusedStub]
[2015-01-31 22:51:01 - Myapp] Warning: class [bin/classes/com/google/android/gms/BuildConfig.class] unexpectedly contains class [com.google.android.gms.BuildConfig]
[2015-01-31 22:51:01 - Myapp] Warning: class [bin/classes/com/google/android/gms/R$attr.class] unexpectedly contains class [com.google.android.gms.R$attr]
[2015-01-31 22:51:01 - Myapp] Warning: class [bin/classes/com/google/android/gms/R$color.class] unexpectedly contains class [com.google.android.gms.R$color]
[2015-01-31 22:51:01 - Myapp] Warning: class [bin/classes/com/google/android/gms/R$drawable.class] unexpectedly contains class [com.google.android.gms.R$drawable]
[2015-01-31 22:51:01 - Myapp] Warning: class [bin/classes/com/google/android/gms/R$id.class] unexpectedly contains class [com.google.android.gms.R$id]
[2015-01-31 22:51:01 - Myapp] Warning: class [bin/classes/com/google/android/gms/R$integer.class] unexpectedly contains class [com.google.android.gms.R$integer]
[2015-01-31 22:51:01 - Myapp] Warning: class [bin/classes/com/google/android/gms/R$string.class] unexpectedly contains class [com.google.android.gms.R$string]
[2015-01-31 22:51:01 - Myapp] Warning: class [bin/classes/com/google/android/gms/R$style.class] unexpectedly contains class [com.google.android.gms.R$style]
[2015-01-31 22:51:01 - Myapp] Warning: class [bin/classes/com/google/android/gms/R$styleable.class] unexpectedly contains class [com.google.android.gms.R$styleable]
[2015-01-31 22:51:01 - Myapp] Warning: class [bin/classes/com/google/android/gms/R.class] unexpectedly contains class [com.google.android.gms.R]
[2015-01-31 22:51:01 - Myapp] Warning: class [bin/classes/com/jeremyfeinstein/slidingmenu/lib/CanvasTransformerBuilder$1.class] unexpectedly contains class [com.jeremyfeinstein.slidingmenu.lib.CanvasTransformerBuilder$1]
[2015-01-31 22:51:01 - Myapp] Warning: class [bin/classes/com/jeremyfeinstein/slidingmenu/lib/CanvasTransformerBuilder$2.class] unexpectedly contains class [com.jeremyfeinstein.slidingmenu.lib.CanvasTransformerBuilder$2]
[2015-01-31 22:51:01 - Myapp] Warning: class [bin/classes/com/jeremyfeinstein/slidingmenu/lib/CanvasTransformerBuilder$6.class] unexpectedly contains class [com.jeremyfeinstein.slidingmenu.lib.CanvasTransformerBuilder$6]
[2015-01-31 22:51:01 - Myapp] Warning: class [bin/classes/com/jeremyfeinstein/slidingmenu/lib/CanvasTransformerBuilder.class] unexpectedly contains class [com.jeremyfeinstein.slidingmenu.lib.CanvasTransformerBuilder]
[2015-01-31 22:51:01 - Myapp] Warning: class [bin/classes/com/jeremyfeinstein/slidingmenu/lib/CustomViewAbove$1.class] unexpectedly contains class [com.jeremyfeinstein.slidingmenu.lib.CustomViewAbove$1]
[2015-01-31 22:51:01 - Myapp] Warning: class [bin/classes/com/jeremyfeinstein/slidingmenu/lib/CustomViewAbove$2.class] unexpectedly contains class [com.jeremyfeinstein.slidingmenu.lib.CustomViewAbove$2]
[2015-01-31 22:51:01 - Myapp] Warning: class [bin/classes/com/jeremyfeinstein/slidingmenu/lib/CustomViewAbove$OnPageChangeListener.class] unexpectedly contains class [com.jeremyfeinstein.slidingmenu.lib.CustomViewAbove$OnPageChangeListener]
[2015-01-31 22:51:01 - Myapp] Warning: class [bin/classes/com/jeremyfeinstein/slidingmenu/lib/CustomViewAbove$SimpleOnPageChangeListener.class] unexpectedly contains class [com.jeremyfeinstein.slidingmenu.lib.CustomViewAbove$SimpleOnPageChangeListener]
[2015-01-31 22:51:01 - Myapp] Warning: class [bin/classes/com/jeremyfeinstein/slidingmenu/lib/SlidingMenu$SavedState.class] unexpectedly contains class [com.jeremyfeinstein.slidingmenu.lib.SlidingMenu$SavedState]
[2015-01-31 22:51:01 - Myapp] Warning: class [bin/classes/com/jeremyfeinstein/slidingmenu/lib/SlidingMenu.class] unexpectedly contains class [com.jeremyfeinstein.slidingmenu.lib.SlidingMenu]
[2015-01-31 22:51:01 - Myapp] Note: there were 7118 duplicate class definitions.
[2015-01-31 22:51:01 - Myapp] Warning: there were 96 classes in incorrectly named files.
[2015-01-31 22:51:01 - Myapp]          You should make sure all file names correspond to their class names.
[2015-01-31 22:51:01 - Myapp]          The directory hierarchies must correspond to the package hierarchies.
[2015-01-31 22:51:01 - Myapp]          If you don't mind the mentioned classes not being written out,
[2015-01-31 22:51:01 - Myapp]          you could try your luck using the '-ignorewarnings' option.
[2015-01-31 22:51:01 - Myapp] Error: Please correct the above warnings first.
конфиг для прогуард таков
XML
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
-injars      bin/classes
-injars      libs
-outjars     bin/classes-processed.jar
 
-libraryjars  /libs/google-play-services_lib/
-libraryjars  /libs/slidingmenu/
 
-dontpreverify
-repackageclasses ''
-allowaccessmodification
-optimizations !code/simplification/arithmetic
-keepattributes *Annotation*
 
-keep public class <MyClass>
 
-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 com.sun.mail.imap.protocol.IMAPSaslAuthenticator
 
-keep public class * extends com.jeremyfeinstein
-keep public class * extends com.google.android.gms
 
 
 
      
#Google Play service
-keep class * extends java.util.ListResourceBundle {
        protected Object[][] getContents();
}
 
 
-keep public class * extends android.view.View {
    public <init>(android.content.Context);
    public <init>(android.content.Context, android.util.AttributeSet);
    public <init>(android.content.Context, android.util.AttributeSet, int);
    public void set*(...);
}
 
-keepclasseswithmembers class * {
    public <init>(android.content.Context, android.util.AttributeSet);
}
 
-keepclasseswithmembers class * {
    public <init>(android.content.Context, android.util.AttributeSet, int);
}
 
-keepclassmembers class * extends android.content.Context {
   public void *(android.view.View);
   public void *(android.view.MenuItem);
}
 
-keepclassmembers class * implements android.os.Parcelable {
    static ** CREATOR;
}
 
-keepclassmembers class **.R$* {
    public static <fields>;
}
 
-keepclassmembers class * {
    @android.webkit.JavascriptInterface <methods>;
}
Очевидно, что проблема в подключаемых библиотеках, но как заставить proguard Их игнорировать?

Добавлено через 4 минуты
Ставил -ignorewarnings , компилируется, но apk глючный
0
Надоела реклама? Зарегистрируйтесь и она исчезнет полностью.
Similar
Эксперт
41792 / 34177 / 6122
Регистрация: 12.04.2006
Сообщений: 57,940
31.01.2015, 23:39
Здравствуйте! Я подобрал для вас темы с ответами на вопрос Внешние библиотеки, компиляция с proguard (Программирование Android):

proguard - Программирование Android
Пытаюсь сделать обфускацию приложения при помощи Proguard. В теории вроде всё просто, на практике - никак не выходит. Для работы...

ProGuard ошибки - Программирование Android
Делаю компиляцию приложения, компилится хорошо, но в процессе работы приложения вылазят ошибки 01-11 22:51:24.745 2552-2747/com.app...

Proguard и NullPointerException - Программирование Android
Задействуйте! Надеюсь кто-то поможет. Проблема такая. В release версии ( с использованием proguard) приложения возникает ошибка ...

ProGuard сопротивление компилированию( - Программирование Android
Народ всем привет. Уже три дня бьюсь с ProGuard все время выходит такая ошибка: Warning:okio.DeflaterSink: can't find referenced class...

Как настраивать Proguard - Программирование Android
Приветствую! Есть необходимость защитить приложение от декомпиляции, для этого хочу использовать Proguard. Почитал статью на оф....

ProGuard на IntelliJ IDEA - Программирование Android
Кто нибудь пробовал в IDEA использовать ProGuard? В project.properties добавил: proguard.config=proguard-project.txt В окне...

0
MoreAnswers
Эксперт
37091 / 29110 / 5898
Регистрация: 17.06.2006
Сообщений: 43,301
31.01.2015, 23:39
Привет! Вот еще темы с ответами:

Как настроить ProGuard в IDEA? - Программирование Android
Сабж. Искал, читал, но до конца так и не понял..

Свое правило для Proguard - Программирование Android
Как создать правило для Proguard? т.е. так чтобы он шифровал только нужные мне файлы...

Оптимизация по размеру при использовании ProGuard - Программирование Android
Помогите, пожалуйста, разобраться. Я работаю в Eclipse. В файле project.properties я добавил строчку...

Eclipse proguard public class android.support.v7.internal.widget.ActionBarView.HomeView - Программирование Android
Добрый день. Сейчас изучаю разработку под андроид. Споткнулся на следующей ошибке This class should be public...


Искать еще темы с ответами

Или воспользуйтесь поиском по форуму:
1
Ответ Создать тему
Опции темы

КиберФорум - форум программистов, компьютерный форум, программирование
Powered by vBulletin® Version 3.8.9
Copyright ©2000 - 2017, vBulletin Solutions, Inc.
Рейтинг@Mail.ru