我开始使用以下代码编写迁移逻辑:https: //github.com/realm/realm-java/blob/master/examples/migrationExample/src/main/java/io/realm/examples/realmmigrationexample/ MigrationExampleActivity.java
编写代码后,我在这一行收到错误:
String path3 = MigrationClass.copyBundledRealmFile(this, this.getResources().openRawResource(R.raw.default1), "default1");
Run Code Online (Sandbox Code Playgroud)
它找不到R.raw.default1文件,因为到目前为止,我使用了默认的Realm,如下所示:
Realm realm = Realm.getInstance(context);
Run Code Online (Sandbox Code Playgroud)
我的问题是我在哪里可以获得此域文件的文件路径?
我检查了文档,我知道如何从对象内访问对象,例如:
RealmResults<User> r1 = realm.where(User.class)
.equalTo("dogs.name", "Fluffy")
.equalTo("dogs.color", "Brown")
.findAll();
Run Code Online (Sandbox Code Playgroud)
但是,如果我在我的User.class中有一个真实主义者:狗,我该如何检查它是否有物品?
RealmResults<User> r1 = realm.where(User.class)
.equalTo("dogs.size", 0)
.findAll();
Run Code Online (Sandbox Code Playgroud) 我从gps得到以下错误:
Fatal Exception: java.lang.NumberFormatException
Invalid double: "-????????"
Run Code Online (Sandbox Code Playgroud)
现在这是我从用户通过Fabric获得的错误.它看起来像阿拉伯语所以我猜它只会发生在那种语言设置,或你的SIM卡?是否可以强制gps发送0-9范围内的字符?或者我能以某种方式解决这个问题?
检查边界是否为null时出现错误:
boundsBuilder.include(new LatLng(loc.getLocation().getLat(), loc.getLocation().getLng()));
bounds = boundsBuilder.build();
if (bounds != null) {
LatLng northEast = bounds.northeast;
LatLng southWest = bounds.southwest;
double movingDistance = SphericalUtil.computeDistanceBetween(northEast, southWest);
Log.i("TRIP", "checkoutTime movingDIstance is:" + movingDistance);
if (movingDistance >= kPSGeofencingShortDistance) {
break;
}
if (activeTrip.getDeparture_time() < time + 1)
time = loc.getTimestamp() / 1000 + 1;
Log.i("TRIP", "checkoutTime time is:" + time);
}
Run Code Online (Sandbox Code Playgroud)
错误是:
error: cannot access zzbgl
class file for com.google.android.gms.internal.zzbgl not found
Run Code Online (Sandbox Code Playgroud)
这是我的依赖项:
dependencies {
implementation 'com.android.support:multidex:1.0.0'
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation …Run Code Online (Sandbox Code Playgroud) 这是我正在尝试执行的代码,但它不起作用。
val JSON = String.format("application/json; charset=utf-8").toMediaType()
(headers as Map<String, String>).toHeaders()
Run Code Online (Sandbox Code Playgroud)
我确实导入了:import okhttp3.MediaType
我需要做什么才能使其识别 toMediaType 和 toHeaders 方法?
这是我添加地理围栏的方式:
public void setGeofenceRequest(Location location) {
if (geofences == null) {
geofences = new ArrayList<Geofence>();
}
geofences.add(new Geofence.Builder()
.setRequestId("3")
.setTransitionTypes(Geofence.GEOFENCE_TRANSITION_EXIT)
.setCircularRegion(
location.getLatitude(), location.getLongitude(), PSLocationService.getInstance(context).kPSGeofencingDistanceMedium)
.setExpirationDuration(Geofence.NEVER_EXPIRE)
.build());
Intent intent = new Intent(context, ReceiveTransitionsBroadcastReceiver.class);
PendingIntent pi = PendingIntent.getBroadcast(context, 0, intent, PendingIntent.FLAG_UPDATE_CURRENT);
if (geofences.size() > 0) {
LocationServices.GeofencingApi.addGeofences(mLocationClient, geofences, pi);
Log.i("", "geof autopilot2 will set geofence for autopilot-3");
}
}
Run Code Online (Sandbox Code Playgroud)
这是我的BroadcastReceiver.我应该在哪里收到它们:
public class ReceiveTransitionsBroadcastReceiver extends BroadcastReceiver {
@Override
public void onReceive(Context ctx, Intent intent) {
Log.i("","autopilot valid geof on receive transisionts broadcast receiver"); …Run Code Online (Sandbox Code Playgroud) android location broadcastreceiver geofencing android-geofence
this is my layout:
<LinearLayout
android:id="@+id/car_linear_layout"
android:layout_toRightOf="@id/car_image"
android:layout_width="wrap_content"
android:orientation="vertical"
android:layout_centerVertical="true"
android:gravity="center_vertical"
android:layout_height="50sp"
android:weightSum="2">
<TextView
android:id="@+id/car_layout_name"
android:textSize="17sp"
android:maxLines="1"
android:textColor="@color/black"
android:ellipsize="end"
android:layout_width="wrap_content"
android:layout_height="0dp"
android:layout_weight="1"/>
<TextView
android:id="@+id/car_layout_license"
android:textSize="17sp"
android:maxLines="1"
android:ellipsize="end"
android:textColor="@color/black"
android:layout_width="wrap_content"
android:layout_height="0dp"
android:layout_weight="1"/>
</LinearLayout>
Run Code Online (Sandbox Code Playgroud)
And this is my code:
if (userVehicleID != null) {
carLayout.setWeightSum(2);
carLicense.setText("test");
}else{
carLayout.setWeightSum(1);
carLicense.setVisibility(View.GONE);
}
Run Code Online (Sandbox Code Playgroud)
But even so, if I debug, and it enters the ELSE , it will show just the first textview, but it's not centered. why?
android android-linearlayout layout-gravity android-layout-weight
这是我拥有的代码:
final FirebaseRemoteConfig config = FirebaseRemoteConfig.getInstance();
FirebaseRemoteConfigSettings configSettings = new FirebaseRemoteConfigSettings.Builder()
.setDeveloperModeEnabled(BuildConfig.DEBUG)
.build();
config.setConfigSettings(configSettings);
config.fetch(0).addOnCompleteListener(new OnCompleteListener<Void>() {
@Override
public void onComplete(@NonNull Task<Void> task) {
if (task.isSuccessful()) {
// After config data is successfully fetched, it must be activated before newly fetched
// values are returned.
config.activateFetched();
final String playStoreVersionCode = FirebaseRemoteConfig.getInstance().getString(
"android_latest_version_code");
} else {
Utils.appendLog("playStoreVersionCode Error fetching latest params ", "E", Constants.TIMELINE);
}
}
});
Run Code Online (Sandbox Code Playgroud)
现在我想增加我的参数,我看到从 3 月份开始有一个 REST API 来更新参数:
https://firebase.google.com/docs/remote-config/api-overview https://firebase.google.com/docs/remote-config/use-config-rest
但我真的不明白教程。为什么我需要使用 curl?这真的有必要像 use-config-rest 链接中那样吗?
curl --compressed …
如果我尝试像这样添加我的 FileProvider:
<provider
android:name="android.support.v4.content.FileProvider"
android:authorities="${applicationId}.myfileprovider"
android:exported="false"
android:grantUriPermissions="true">
<meta-data
android:name="android.support.FILE_PROVIDER_PATHS"
android:resource="@xml/provider_paths" />
</provider>
Run Code Online (Sandbox Code Playgroud)
我遇到了以下问题:
Caused by: java.lang.RuntimeException: Manifest merger failed with multiple errors, see logs
at com.android.builder.core.AndroidBuilder.mergeManifestsForApplication(AndroidBuilder.java:524)
at com.android.build.gradle.tasks.MergeManifests.doFullTaskAction(MergeManifests.java:143)
at com.android.build.gradle.internal.tasks.IncrementalTask.taskAction(IncrementalTask.java:106)
at org.gradle.internal.reflect.JavaMethod.invoke(JavaMethod.java:73)
at org.gradle.api.internal.project.taskfactory.IncrementalTaskAction.doExecute(IncrementalTaskAction.java:50)
at org.gradle.api.internal.project.taskfactory.StandardTaskAction.execute(StandardTaskAction.java:39)
at org.gradle.api.internal.project.taskfactory.StandardTaskAction.execute(StandardTaskAction.java:26)
at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter$1.run(ExecuteActionsTaskExecuter.java:131)
at org.gradle.internal.operations.DefaultBuildOperationExecutor$RunnableBuildOperationWorker.execute(DefaultBuildOperationExecutor.java:317)
at org.gradle.internal.operations.DefaultBuildOperationExecutor$RunnableBuildOperationWorker.execute(DefaultBuildOperationExecutor.java:309)
at org.gradle.internal.operations.DefaultBuildOperationExecutor.execute(DefaultBuildOperationExecutor.java:185)
at org.gradle.internal.operations.DefaultBuildOperationExecutor.run(DefaultBuildOperationExecutor.java:97)
at org.gradle.internal.operations.DelegatingBuildOperationExecutor.run(DelegatingBuildOperationExecutor.java:31)
at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.executeAction(ExecuteActionsTaskExecuter.java:120)
at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.executeActions(ExecuteActionsTaskExecuter.java:99)
Run Code Online (Sandbox Code Playgroud)
如果我删除“权威”行,我会得到这个:
Manifest merger failed : Attribute meta-data#android.support.FILE_PROVIDER_PATHS@resource value=(@xml/provider_paths) from AndroidManifest.xml:374:17-55
is also present at [io.smooch:ui:5.12.5] AndroidManifest.xml:50:17-51 value=(@xml/file_paths).
Suggestion: add 'tools:replace="android:resource"' to <meta-data> element at AndroidManifest.xml:372:13-374:58 to …Run Code Online (Sandbox Code Playgroud) 这是我的界面:
interface DialogOkClickListener {
fun onDialogOkClick()
}
Run Code Online (Sandbox Code Playgroud)
这是我的 clickListener
fun setOkClickListener(okClickListener: DialogOkClickListener): DialogOkCancel {
this.okClickListener = okClickListener
return this
}
Run Code Online (Sandbox Code Playgroud)
这是它目前的工作方式:
.setOkClickListener(object : DialogOkCancel.DialogOkClickListener{
override fun onDialogOkClick() {
TODO("not implemented") //To change body of created functions use File | Settings | File Templates.
}
})
Run Code Online (Sandbox Code Playgroud)
但如果我尝试这样的事情:
.setCancelClickListener{ methodToCall() }
Run Code Online (Sandbox Code Playgroud)
我得到 type missmatch found () -> String
android ×8
database ×2
kotlin ×2
realm ×2
arabic ×1
build.gradle ×1
coordinates ×1
firebase ×1
geofencing ×1
google-maps ×1
gps ×1
header ×1
lambda ×1
list ×1
location ×1
media-type ×1
merge ×1
migration ×1
networking ×1
okhttp3 ×1
onclick ×1
realm-list ×1
rest ×1
smooch ×1