【发布时间】:2021-12-09 21:06:14
【问题描述】:
我添加了 proguard 规则 -assumenosideeffects class android.util.Log {public *;} 所以我的发布版本没有日志。但在那之后,一个特定的方法停止工作:
SingleShotLocationProvider.requestSingleUpdate(PassagerActivity.this,
new SingleShotLocationProvider.LocationCallback() {
@Override public void onNewLocationAvailable(SingleShotLocationProvider.GPSCoordinates location) {
// Log.e("xxx",location.latitude + "/" +location.longitude);
map.setCenter(new GeoCoordinate(location.latitude, location.longitude, 0.0),
Map.Animation.NONE);
currentloc = new LatLng(location.latitude, location.longitude);
// loadingDialog.stopLoadingDialog();
new Thread(new Runnable() {
public void run() {
GeoCoderApi.getAdressfromLatLng(PassagerActivity.this , location ,new GeoCoderApi.AdressCallback() {
@Override
public void onAdressAvailable(String adress) {
// Log.e("xxxadress",adress);
addDepart.post(new Runnable() {
public void run() {
addDepart.setText(adress);
}
});
}
}); }}).start();
}
});
此方法获取 lat 和 lng 并从 google GeoCoder 获取地址。 当我删除 proguard 规则时,一切正常。甚至不知道它是如何相关的。我在 4 种不同的设备上尝试过。
编辑:
在这里你可以看到 map.center() 工作,我可以得到本地化它只是 addDepart.setText() 不起作用。
【问题讨论】:
标签: android logging proguard google-geocoder