Place Picker在alpha测试中崩溃,但在android工作室中没有崩溃



我遇到了一个我真的无法解决的问题! 我的应用程序在开发环境中完美运行,无论是在 android studio 模拟器上还是在我用于预测试的手机上(荣耀 8),但在 google play 上创建 alpha 测试后,我收到以下错误:

我按下按钮启动 Picker Place,他激活了自己,但片刻后他关闭了,不允许您选择您所在的位置,这个问题在开发的任何时刻我都没有发生过,在我的手机上的个人测试中也在不同的地方使用它,因为它被加载到我的手机上。 老实说,我的 API 密钥已经激活了 1 年多,但由于个人问题我无法继续开发,您认为这会干扰 API 的正确 APK 操作吗?

在 Google API 仪表板中检查密钥是否有效且处于活动状态。

在这里,我报告我的清单和我用来调用我的 Piker 的代码:

清单:

<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
package="com.miapp.miapp">
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
<uses-permission android:name="android.permission.INTERNET" />
<uses-feature
android:glEsVersion="0x00020000"
android:required="true" />
<application
android:allowBackup="true"
android:icon="@mipmap/ic_launcher"
android:label="@string/app_name"
android:roundIcon="@mipmap/ic_launcher_round"
android:supportsRtl="true"
android:theme="@style/AppTheme"
android:fullBackupContent="true"
tools:ignore="GoogleAppIndexingWarning">
<meta-data
android:name="com.google.android.gms.version"
android:value="@integer/google_play_services_version" />
<meta-data
android:name="com.google.android.geo.API_KEY"
android:value="@ApiKey" />
<activity android:name=".Find_Place">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity android:name=".OkRes_Activity" />
<activity android:name=".PutIn_Activity"/>
<activity android:name=".utilityBOperation" />
</application>
</manifest>

呼叫派克:

placeNameText.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
Log.v(TAG, "Find_Place:placeNameText.setOnClickListener: OnCreate : Ho cliccato la mia Text");
//Richiamo il costruttore del mio Piker
Log.v(TAG, "Find_Place:placeNameText.setOnClickListener: Start....... Richiamo il Piker con IntentBuilder....");
IntentBuilder builder = new IntentBuilder();
try {
Intent intent = builder.build(Find_Place.this);
Log.v(TAG, "Find_Place: OnCreate : Builder : Start....... Lancio il mio builder nell'activity....");
startActivityForResult(intent, PLACE_PICKER_REQUEST);
Toast.makeText(getApplicationContext(), "Sto chiamando il piker ed attendendo il risultato", Toast.LENGTH_LONG).show();
} catch (GooglePlayServicesRepairableException | GooglePlayServicesNotAvailableException e) {
e.printStackTrace();
String message;
message = e.getMessage();
Toast.makeText(getApplicationContext(), message, Toast.LENGTH_LONG).show();
Log.v(TAG, "Find_Place: OnCreate : Builder : C'è stato un errore .... " + e);
}
}
});

检查结果

protected void onActivityResult(int requestCode, int resultCode, Intent data) {
super.onActivityResult(requestCode, resultCode, data);
//  Popolo la mia texviView con i miei dati
Toast.makeText(getApplicationContext(),"Sono nel onActivityResult ",Toast.LENGTH_LONG).show();
Log.v(TAG,"Find_Place: OnCreate : onActivityResult : Gestisco il risultato del Piker  .... " );
if (requestCode== PLACE_PICKER_REQUEST)
{
Toast.makeText(getApplicationContext(),"Sono nel onActivityResult: requestCode== PLACE_PICKER_REQUEST" + PLACE_PICKER_REQUEST,Toast.LENGTH_LONG).show();
Log.v(TAG, "Find_Place:onActivityResult: Valore del requestCode== PLACE_PICKER_REQUEST " + PLACE_PICKER_REQUEST);
if (resultCode == RESULT_OK) {
Toast.makeText(getApplicationContext(),"Sono nel onActivityResult: resultCode == RESULT_OK",Toast.LENGTH_LONG).show();
Log.v(TAG, "Find_Place:onActivityResult: Valore del resultCode........." + resultCode);
Place place = PlacePicker.getPlace(Find_Place.this, data);

我无法添加错误日志,因为即使从谷歌播放 consol 也没有任何崩溃。 如果你能帮助我,我真的不明白问题是什么! 当我在那里时,我添加了这个问题,据您说,我已将所有进程插入onActivityResult可能会导致问题,因此如果未激活选择器,则无法继续?

谢谢大家的帮助

最后我设法自己解决了它,并在下面编写了解决方案来帮助任何发现相同问题的人。 poroblema源于这样一个事实,即我们创建了一个api密钥,我们将将其插入到代码中,但仅用作测试密钥。当我们创建 ALPHA 或 BETA 版时,Google Play 管理中心会自动生成一个 API 密钥,与在创建应用程序期间生成的 API 密钥一起插入我们的 GOOGLE 开发者控制台,这将允许我们在开发版本中使用我们的应用程序中请求的 API。 重要 应添加未被旧 API 密钥替换的新 API 密钥,否则将无法再在开发环境中使用该 API。

我希望它会有用。

最新更新