我正在尝试在上传到Google Play商店之前在发布模式下测试该应用程序,但是我收到类似
"E/AsyncHttpRequest: unhandle exception origin 导致 java.lang.ClassCastException: $Proxy 0 不能强制转换为 d.a.a.a.k.h"。
如果有人遇到同样的问题并找到了解决方案,请告诉我,谢谢。在调试模式下,它工作正常,但在发布模式下,我收到错误
早些时候它也在发布模式下工作,但现在它无法在发布模式下工作
phoneNo = phoneText.getText().toString();
System.out.println( phoneNo );
params.put( "mob_no", phoneNo );
//String debugHashKey = "Yq%2BZIxNoG%2BK";
String releaseHashKey = "hFmVMD4X1DR";
System.out.println( releaseHashKey );
params.put( "uniqueKey", releaseHashKey );
try {
asyncHttpClient.post( mob_validate, params, new JsonHttpResponseHandler() {
@Override
public void onSuccess(int statusCode, Header[] headers, JSONObject response) {
try {
System.out.println( "onSuccess" );
status = response.getString( "status" );
msg = response.getString( "msg" );
Toast.makeText( getApplicationContext(), msg, Toast.LENGTH_SHORT ).show();
if (status.equals( "success" )) {
Intent intent = new Intent( MainActivity.this, OTPConfirmationActivity.class );
intent.putExtra( "phone_no", phoneNo );
startActivity( intent );
finish();
}
} catch (JSONException e) {
e.printStackTrace();
}
}
@Override
public void onFailure(int statusCode, Header[] headers, Throwable throwable, JSONObject errorResponse) {
//Toast.makeText( getApplicationContext(), R.string.onFailure, Toast.LENGTH_SHORT ).show();
}
@Override
public void onFailure(int statusCode, Header[] headers, String responseString, Throwable throwable) {
super.onFailure( statusCode, headers, responseString, throwable );
}
@Override
public void onStart() {
progressBar.setVisibility( View.VISIBLE );
}
@Override
public void onFinish() {
progressBar.setVisibility( View.INVISIBLE );
}
} );
} catch (ClassCastException e) {
e.printStackTrace();
}
/////////////////build.gradle file//////////////////////
apply plugin: 'com.android.application'
android {
signingConfigs {
release {
storeFile file('/home/eazysoft/Documents/finalKey/releaseKey.jks')
storePassword 'password'
keyAlias = 'upload'
keyPassword 'password'
}
}
compileSdkVersion 28
defaultConfig {
applicationId "com.eazysoft.lookAround"
minSdkVersion 15
targetSdkVersion 28
versionCode 2
versionName "1.0.1"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
multiDexEnabled true
signingConfig signingConfigs.release
}
buildTypes {
release {
minifyEnabled true
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
signingConfig signingConfigs.release
debuggable = true
}
}
}
dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation 'com.android.support:appcompat-v7:28.0.0'
implementation 'com.android.support:support-v4:28.0.0'
implementation 'com.android.support.constraint:constraint-layout:2.0.0-alpha4'
testImplementation 'junit:junit:4.13-beta-2'
androidTestImplementation 'com.android.support.test:runner:1.0.2'
androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.2'
implementation 'com.android.support:design:28.0.0'
implementation 'com.android.support:multidex:1.0.3'
implementation 'com.android.support:recyclerview-v7:28.0.0'
implementation 'com.android.support:cardview-v7:28.0.0'
implementation 'com.android.support:design:28.0.0'
implementation 'com.android.support:exifinterface:28.0.0'
implementation 'com.google.android.gms:play-services-maps:16.1.0'
implementation 'com.google.android.gms:play-services-location:16.0.0'
implementation 'com.google.android.gms:play-services-base:16.1.0'
implementation 'com.google.android.gms:play-services-identity:16.0.0'
implementation 'com.google.android.gms:play-services-auth:16.0.1'
implementation 'com.google.android.gms:play-services-auth-api-phone:16.0.0'
implementation 'com.loopj.android:android-async-http:1.4.9'
}
请为我提供适用于短信检索器 API 的解决方案,以便我可以将我的应用程序上传到 Play 商店。
在应用级 gradle 中更新您的发布块:
release {
minifyEnabled true
useProguard true
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
ProGuard-Android.txt 在您创建项目时自动生成。打开文件并在其中添加这些规则。
-keep class cz.msebera.android.httpclient.** { *; }
-keep class com.loopj.android.http.** { *; }