标签: sugarorm

.dex文件中的方法引用数不能超过64k API 17

我正在使用SugarORM Library构建一个应用程序但是当我尝试为API 17构建项目时(没有检查其他人)它显示了构建错误.

    Information:Gradle tasks [:app:assembleDebug]
:app:preBuild UP-TO-DATE
:app:preDebugBuild UP-TO-DATE
:app:checkDebugManifest
:app:preReleaseBuild UP-TO-DATE
:app:prepareComAndroidSupportAnimatedVectorDrawable2330Library UP-TO-DATE
:app:prepareComAndroidSupportAppcompatV72330Library UP-TO-DATE
:app:prepareComAndroidSupportCardviewV72330Library UP-TO-DATE
:app:prepareComAndroidSupportDesign2330Library UP-TO-DATE
:app:prepareComAndroidSupportMediarouterV72300Library UP-TO-DATE
:app:prepareComAndroidSupportRecyclerviewV72330Library UP-TO-DATE
:app:prepareComAndroidSupportSupportV42330Library UP-TO-DATE
:app:prepareComAndroidSupportSupportVectorDrawable2330Library UP-TO-DATE
:app:prepareComAndroidVolleyVolley100Library UP-TO-DATE
:app:prepareComGithubSatyanSugar14Library UP-TO-DATE
:app:prepareComGoogleAndroidGmsPlayServices840Library UP-TO-DATE
:app:prepareComGoogleAndroidGmsPlayServicesAds840Library UP-TO-DATE
:app:prepareComGoogleAndroidGmsPlayServicesAnalytics840Library UP-TO-DATE
:app:prepareComGoogleAndroidGmsPlayServicesAppindexing840Library UP-TO-DATE
:app:prepareComGoogleAndroidGmsPlayServicesAppinvite840Library UP-TO-DATE
:app:prepareComGoogleAndroidGmsPlayServicesAppstate840Library UP-TO-DATE
:app:prepareComGoogleAndroidGmsPlayServicesAuth840Library UP-TO-DATE
:app:prepareComGoogleAndroidGmsPlayServicesBase840Library UP-TO-DATE
:app:prepareComGoogleAndroidGmsPlayServicesBasement840Library UP-TO-DATE
:app:prepareComGoogleAndroidGmsPlayServicesCast840Library UP-TO-DATE
:app:prepareComGoogleAndroidGmsPlayServicesDrive840Library UP-TO-DATE
:app:prepareComGoogleAndroidGmsPlayServicesFitness840Library UP-TO-DATE
:app:prepareComGoogleAndroidGmsPlayServicesGames840Library UP-TO-DATE
:app:prepareComGoogleAndroidGmsPlayServicesGcm840Library UP-TO-DATE
:app:prepareComGoogleAndroidGmsPlayServicesIdentity840Library UP-TO-DATE
:app:prepareComGoogleAndroidGmsPlayServicesLocation840Library UP-TO-DATE
:app:prepareComGoogleAndroidGmsPlayServicesMaps840Library UP-TO-DATE
:app:prepareComGoogleAndroidGmsPlayServicesMeasurement840Library UP-TO-DATE
:app:prepareComGoogleAndroidGmsPlayServicesNearby840Library UP-TO-DATE
:app:prepareComGoogleAndroidGmsPlayServicesPanorama840Library UP-TO-DATE
:app:prepareComGoogleAndroidGmsPlayServicesPlus840Library UP-TO-DATE
:app:prepareComGoogleAndroidGmsPlayServicesSafetynet840Library UP-TO-DATE
:app:prepareComGoogleAndroidGmsPlayServicesVision840Library UP-TO-DATE
:app:prepareComGoogleAndroidGmsPlayServicesWallet840Library …
Run Code Online (Sandbox Code Playgroud)

android gradle android-gradle-plugin sugarorm android-multidex

122
推荐指数
10
解决办法
12万
查看次数

Android:Sugar ORM没有这样的表格例外

No Such table当我使用Sugar ORMGPU图像Android库时,我得到了例外.我正在使用Gradle和Android Studio.一旦我删除GPU图像这个问题就解决了.所以我不知道什么导致这个例外.关于这个例外的细节也在这个git问题中讨论, 似乎很多人仍然面临着这个问题.

我的崩溃日志发布在下面

> 10-09 11:30:21.511 4326-4831/com.example.app E/SQLiteLog: (10) Failed
> to do file read, got: 0, amt: 100, last Errno: 2 10-09 11:30:26.506
> 4326-4831/com.example.app E/SQLiteLog: (1) no such table: IMAGE 10-09
> 11:30:26.516 4326-4831/com.example.app E/AndroidRuntime: FATAL
> EXCEPTION: AsyncTask #1 10-09 11:30:26.516 4326-4831/com.example.app
> E/AndroidRuntime: java.lang.RuntimeException: An error occured while
> executing doInBackground() 10-09 11:30:26.516
> 4326-4831/com.example.app E/AndroidRuntime:     at
> android.os.AsyncTask$3.done(AsyncTask.java:299) 10-09 11:30:26.516
> 4326-4831/com.example.app E/AndroidRuntime:     at …
Run Code Online (Sandbox Code Playgroud)

sqlite android gpuimage sugarorm

38
推荐指数
11
解决办法
3万
查看次数

Sugar ORM不会创建表

我正在开发一个独立的库项目,需要持久化一个简单的模型.这是我的SugarRecord样子:

/**
 *  Keeping track of previously received messages by ID
 */

public class MessageRequestIdModel extends SugarRecord {

    protected String messageRequestId;

    public MessageRequestIdModel() {

    }

    public MessageRequestIdModel(String messageRequestId) {
        this.messageRequestId = messageRequestId;
    }

    public String getMessageRequestId() {
        return this.messageRequestId;
    }

    public static boolean exists(String id) {
        return MessageRequestIdModel.find(
                MessageRequestIdModel.class,
                "messageRequestId = ?",
                id
        ).size() != 0;
    }
}
Run Code Online (Sandbox Code Playgroud)

在存储库类中,我试图通过调用此方法来持久化它:

@Override
public void save(MessageRequestId messageRequestId) {
    new MessageRequestIdModel(messageRequestId.getId()).save();
}
Run Code Online (Sandbox Code Playgroud)

我现在尝试通过使用android.test.InstrumentationTestCase我传递Context给Sugar 的地方来测试它,如下所示:

SugarContext.init(getInstrumentation().getContext());
Run Code Online (Sandbox Code Playgroud)

当我运行测试时,这会导致此错误:(截断以使此问题简洁易读)

android.database.sqlite.SQLiteException: no …
Run Code Online (Sandbox Code Playgroud)

sqlite android android-testing android-sqlite sugarorm

18
推荐指数
2
解决办法
1万
查看次数

使用SugarORM和GSON解析字符串ID

我正在使用json响应GSON创建一个SugarRecord对象.我正在使用的API返回一个名为"id"的字段,但"id"的类型是一个字符串,而不是long(后端使用mongo).

以下是我正在使用的代码:

Gson gson = new Gson(); // Or use new GsonBuilder().create();
NutritionPlan target = gson.fromJson(jsonObject.getJSONObject("nutrition_day").toString(), NutritionPlan.class);
Run Code Online (Sandbox Code Playgroud)

以下是我的json回复:

{
"nutrition_day": {
    "id": "5342b4163865660012ab0000",
    "start_on": "2014-04-08",
    "protein_target": 157,
    "sodium_limit": 2000
}
Run Code Online (Sandbox Code Playgroud)

有没有一种很好的方法来处理这种情况?我试过了

@Ignore 
long id;
Run Code Online (Sandbox Code Playgroud)

@SerializedName("id")
String nutrition_plan_id;
Run Code Online (Sandbox Code Playgroud)

在我的模型中,但没有帮助.任何熟悉Sugar ORM的人,知道如何处理id不长的领域?

android json gson sugarorm

11
推荐指数
1
解决办法
2299
查看次数

从Sugar db保存和检索数据而不重复

我正在使用Sugar ORM来持久保存和检索数据.下面是我用来存储和检索数据的代码.

Slider.deleteAll(Slider.class);
JsonObjectRequest jsonObjectRequest = new JsonObjectRequest(Request.Method.POST, Constants.URL, jsonRepos.getSliderJobj(),
    new Response.Listener<JSONObject>() {
        @Override
        public void onResponse(JSONObject response) {
            Log.d(Constants.MAINACTIVITY,response.toString());
            try {
                JSONArray sliderArray = response.getJSONArray("slider");
                    for (int i=0; i<sliderArray.length(); i++){
                        JSONObject sliderArrayJSONObject = sliderArray.getJSONObject(i);
                        String id = sliderArrayJSONObject.getString("id");
                        String albumId = sliderArrayJSONObject.getString("album_id");
                        String title = sliderArrayJSONObject.getString("title");
                        String imgUrl = sliderArrayJSONObject.getString("img_url");
                        String file = sliderArrayJSONObject.getString("file");
                        Log.d(Constants.MAINACTIVITY,file);
                        Log.d("Note", "saving");
                        Slider slider = new Slider(id, albumId, title , file, imgUrl);
                        slider.save();
                    }
                catch (JSONException e) {
                    e.printStackTrace();
                }
            }
            },
        appController.getErrorListener()
    ); …
Run Code Online (Sandbox Code Playgroud)

android sugarorm

9
推荐指数
0
解决办法
307
查看次数

具有现有数据库和自定义文件路径的Android Sugar ORM

我完全能够使用提供的示例使用Sugar ORM.

在我的用例中,我从服务器下载了一个SQLite DB(ETL加载它的数百万条记录,因此必须在服务器端完成).下载保存到内部存储上的自定义路径.

在我的情况下,我不需要基于POCO创建动态数据库.

如果所有POCO类字段都与表结构匹配,是否可以将Sugar ORM与预先存在的SQLite DB一起使用,指向自定义路径?

android sugarorm

8
推荐指数
1
解决办法
7159
查看次数

Android的ORM无法找到我的列名

好吧,我正在尝试选择所有实体 entitie_id = *some id*

我这样做有这个规则:

List<NodeSugar> nodesugars = NodeSugar.find(NodeSugar.class, "entitie_id = ? ", String.valueOf(nodeid));
Run Code Online (Sandbox Code Playgroud)

我知道我应该得到一些结果,我得到一个错误.这个错误:

E/SQLiteLog? (1) no such column: entitie_id
Run Code Online (Sandbox Code Playgroud)

我知道列存在,因为我可以在代码的不同部分设置它.

我哪里错了?

sqlite android sugarorm

8
推荐指数
2
解决办法
4847
查看次数

Sugar ORM listAll()没有显示任何数据

我正在尝试从listview中获取数据库中的数据,如下所示.

  long count = UserTableSugar.count(UserTableSugar.class);
    if(count>0)
    {
        UserTableSugar.listAll(UserTableSugar.class);
        List<UserTableSugar> userTable = UserTableSugar.listAll(UserTableSugar.class);
        CustomAdapterListview madapter = new CustomAdapterListview(getApplicationContext(),userTable);
        listView.setAdapter(madapter);
    }
Run Code Online (Sandbox Code Playgroud)

但是,数据不会显示出来.在调试时,count的值为2(表中有两个记录).但列表userTable的大小显示为0.

求助:添加模型类的空构造函数就可以了.

android sugarorm android-database

8
推荐指数
1
解决办法
1456
查看次数

Android:SugarORM和multidex

我正在使用使用SugarORM的Android项目.现在方法限制已经增加了很多,我必须激活multidex支持.但是现在我遇到了SugarORM的问题,它只创建了classes.dex文件中的表.它似乎完全忽略了classes2.dex.这真的是Sugar中的一个错误,是否有一些好方法可以绕过这个问题?

android sugarorm android-multidex

7
推荐指数
1
解决办法
649
查看次数

Jackson + SugarOrm id错误

我使用jackson和sugar orm,解析时遇到一些错误.id字段始终位于json中0.我该怎么做才能修复它?

我的课这个例子:

@JsonIgnoreProperties(ignoreUnknown = true)
public class JsonScienceEvent extends SugarRecord<JsonScienceEvent>{

    @JsonProperty("id")
    private String eventId;

public JsonScienceEvent()

public JsonScienceEvent(String eventId){
    this.eventId = eventId;
}

public String getEventId(){
    return eventId;
}
Run Code Online (Sandbox Code Playgroud)

android jackson sugarorm

7
推荐指数
1
解决办法
141
查看次数