我们为我们的应用程序使用Realm.我们的应用已经发布测试版.现在我想在我们的一个领域对象中添加一个字段.所以我写了RealmMigration,我也写了一个.这里的问题是如何将此Realm迁移应用到我的应用程序.我使用Realm.getInstance()在我想要的时候获取领域实例.请记住,Realm.getInstance()每次都在整个应用程序中使用,我想访问Realm数据库.
那么,我有点询问如何应用这种迁移?任何线索都可能有所帮助.谢谢.
我的RealmMigration如下.
public class RealmMigrationClass implements RealmMigration {
@Override
public void migrate(DynamicRealm realm, long oldVersion, long newVersion) {
if(oldVersion == 0) {
RealmSchema sessionSchema = realm.getSchema();
if(oldVersion == 0) {
RealmObjectSchema sessionObjSchema = sessionSchema.get("Session");
sessionObjSchema.addField("isSessionRecordingUploading", boolean.class, FieldAttribute.REQUIRED)
.transform(new RealmObjectSchema.Function() {
@Override
public void apply(DynamicRealmObject obj) {
obj.set("isSessionRecordingUploading", false);
}
});
sessionObjSchema.setNullable("isSessionRecordingUploading",false);
oldVersion++;
}
}
}
}
public class Session extends RealmObject {
@PrimaryKey
private String id;
@Required
private Date date;
private double latitude;
private double longitude;
private String location; …Run Code Online (Sandbox Code Playgroud) 我最近更新了我的kotlin和kotlin扩展插件,在构建时我收到以下错误.我尝试使用gradle清理构建或同步项目,但没有任何作用
e: Supertypes of the following classes cannot be resolved. Please make sure you have the required dependencies in the classpath:
Error:Execution failed for task ':app:compileDebugKotlin'.
> Compilation error. See log for more details
Run Code Online (Sandbox Code Playgroud)
build.gradle如下
apply plugin: 'com.android.application'
apply plugin: 'kotlin-android'
buildscript {
ext.kotlin_version = '1.0.0-beta-1038'
ext.anko_version = '0.7.2'
ext.android_support_version = '23.0.1'
ext.android_extensions_version = '1.0.0-beta-1038'
repositories {
jcenter()
mavenCentral()
}
dependencies {
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
classpath "org.jetbrains.kotlin:kotlin-android-extensions:$kotlin_version"
}
}
android {
compileSdkVersion 23
buildToolsVersion "23.0.1"
defaultConfig {
applicationId "com.xxxxxxxxxx.app"
minSdkVersion 18 …Run Code Online (Sandbox Code Playgroud) 深度链接在 Android 中不起作用。我已将清单代码粘贴到此处。当我测试时,它会访问网站,而不是在我的应用程序中打开我的活动。有人可以帮我解决这个问题吗?
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.clinicloud.app" >
<application
android:name=".MainApp"
android:allowBackup="true"
android:icon="@mipmap/ic_launcher"
android:label="@string/app_name"
android:supportsRtl="true"
android:theme="@style/AppTheme" >
<activity
android:name=".MainActivity"
android:label="@string/app_name"
android:theme="@style/AppTheme.NoActionBar" >
<intent-filter>
<action android:name="android.intent.action.VIEW" />
<category android:name="android.intent.category.DEFAULT" />
<category android:name="android.intent.category.BROWSABLE" />
<data
android:host="www.XXXX.com"
android:pathPrefix="/xyz"
android:scheme="http"/>
</intent-filter>
</activity>
<activity
android:name=".OnboardingActivity"
android:label="@string/app_name"
android:theme="@style/AppTheme.NoActionBar" >
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity
android:name=".ProfileViewActivity"
android:label="@string/title_activity_profile_view"
android:theme="@style/AppTheme.NoActionBar" >
</activity>
</application>
</manifest>
Run Code Online (Sandbox Code Playgroud)
更新:
adb shell am start -W -a android.intent.action.VIEW -d " http://www.clinicloud.com/xyz " com.clinicloud.app
使用 adb 测试会打开应用程序,但仅使用浏览器测试不会打开应用程序。
我正在使用Kotlin Fuel框架来进行REST API调用.实际上,只要api有http uri,一切都运行良好.但是当uris作为HTTP安装SSL证书时,我无法从亚马逊服务器下载图像.我收到以下错误并阻止了UI.有没有人知道如何解决这个问题?
11-11 12:26:34.865 5060-5071/? I/art: Background partial concurrent mark sweep GC freed 39770(1365KB) AllocSpace objects, 2(136KB) LOS objects, 39% free, 4MB/7MB, paused 10ms total 10ms
11-11 12:26:43.525 5060-5071/? I/art: Background sticky concurrent mark sweep GC freed 111790(2MB) AllocSpace objects, 0(0B) LOS objects, 25% free, 7MB/9MB, paused 10ms total 10ms
11-11 12:26:44.885 5060-5071/? I/art: Background sticky concurrent mark sweep GC freed 106842(2MB) AllocSpace objects, 0(0B) LOS objects, 24% free, 7MB/9MB, paused 10ms total 10ms
11-11 12:26:54.995 5060-5071/? I/art: …Run Code Online (Sandbox Code Playgroud) 我已经创建了 dockerfile。
FROM ubuntu:latest
RUN apt-get update && apt-get -y upgrade
RUN apt-get -y install curl
RUN apt-get -y install default-jre
RUN curl -O http://archive.apache.org/dist/activemq/5.16.0/apache-activemq-5.16.0-bin.tar.gz
RUN mkdir -p /opt/apache/activemq
RUN tar xvzf apache-activemq-5.16.0-bin.tar.gz -C /opt/apache/activemq
WORKDIR /opt/apache/activemq/apache-activemq-5.16.0/bin
VOLUME /opt/apache/activemq/apache-activemq-5.16.0/conf
RUN echo './activemq start && tail -f /opt/apache/activemq/apache-activemq-5.16.0/data/activemq.log' > start.sh
# Admin interface
EXPOSE 8161
# Active MQ's default port (Listen port)
EXPOSE 61616
CMD ["/bin/bash", "./start.sh"]
Run Code Online (Sandbox Code Playgroud)
我创建了一个这样的 docker 容器
docker run --name activemq -p 8161:8161 -p 61616:61616 temp-activemq:5.16.0
Run Code Online (Sandbox Code Playgroud)
我尝试按如下方式运行管理控制台
http:://localhost:8161/admin/ …Run Code Online (Sandbox Code Playgroud)