Tôi đã cố tạo APK bằng cách sử dụng trình bảo vệ, nhưng tôi gặp lỗi này khi cố gắng tạo:com.google.android.gms.internal.zzhu: không thể tìm thấy lớp được tham chiếu android.security.NetworkSecurityPolicy
Warning: com.google.android.gms.internal.zzhu: can't find referenced class android.security.NetworkSecurityPolicy
Warning: there were 3 unresolved references to classes or interfaces.
You may need to add missing library jars or update their versions. If your code works fine without the missing classes, you can suppress the warnings with '-dontwarn' options.
(http://proguard.sourceforge.net/manual/troubleshooting.html#unresolvedclass)
:app:proguardRelease FAILED
Error:Execution failed for task ':app:proguardRelease'.
java.io.IOException: Please correct the above warnings first.
Gần đây, tôi đã nâng cấp Công cụ SDK Android của mình. Trước đó, dự án này không có vấn đề gì với proguard. Tôi thấy bài này (https://plus.google.com/+PaulBurke/posts/T3vmAnRP3q6), nơi Oliver Renner đã viết:.
"Vì vậy, về cơ bản là thư viện Google tiếp theo mà có thể không được nâng cấp lên phiên bản mới nhất này cũng dường như đòi hỏi compileSdk 23 để có thể sử dụng ProGuard mà không sửa đổi (Cảnh báo: com.google.android.gms.internal.zzhu: không thể tìm thấy lớp được tham chiếu android.security.NetworkSecurityPolicy) "*
Tôi đã cập nhật dự án của mình để biên dịch bằng SDK 23, nhưng vấn đề đã không được giải quyết.
Bellow, tôi bao gồm một số bộ phận của tập tin build.gradle tôi:
compileSdkVersion 23
buildToolsVersion "23.0.0"
defaultConfig {
applicationId "com.sample.sample"
minSdkVersion 16
targetSdkVersion 23
versionCode 1
versionName "1.0.0"
}
.
.
.
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
compile 'com.android.support:appcompat-v7:23.0.0'
compile 'com.google.android.gms:play-services:+'
compile 'com.android.support:design:23.0.0'
compile('com.crashlytics.sdk.android:crashlytics:[email protected]') {
transitive = true;
}
}
Bạn có thử '-dontwarn android.security **' Thêm cố gắng vô hiệu hóa tối ưu hóa với '-dontoptimize' và xem làm thế nào nó đi – ThanosFisherman
Nó không hoạt động:/ –
Ok hãy thử cái này: Trong tệp gradle đính kèm của bạn, trong 'buildToolsVersion" 23.0.0 "', hãy nhập 'useLibrary 'org.apache.http.legacy'' sau đây nếu nó hoạt động, tôi sẽ viết một câu trả lời chi tiết hơn về cách thức và lý do tại sao điều này làm việc – ThanosFisherman