小编Ela*_*da2的帖子

即使在全新安装和重新运行后,也无法将数据库从版本2降级为1

我正在使用SQLite DB编写一个Android应用程序.

我进行了很少的实验,并将数据库版本从1更改为2.

然后我的数据库架构变得稳定,因为我没有发布应用程序,它是我自己使用的

我决定再次将版本更改为1.

我做了全新安装,一切正常.

但是第二次运行会抛出这个错误:

06-05 10:03:35.683: E/AndroidRuntime(9010): android.database.sqlite.SQLiteException: Can't downgrade database from version 2 to 1
06-05 10:03:35.683: E/AndroidRuntime(9010):     at android.database.sqlite.SQLiteOpenHelper.onDowngrade(SQLiteOpenHelper.java:361)
Run Code Online (Sandbox Code Playgroud)

为什么这样,毕竟我做了全新安装,DB也应该被删除了.没有?

如何将版本再次更改为1?

java database sqlite android

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

roboblender-3.0.1.jar:不包含在Android中:javax.tools.引自com.google.inject.blender.AnnotationDatabaseGenerator

我尝试构建我的android项目,我得到:

Information:Gradle: Executing tasks: [clean, :app:compileDebugSources]
Information:1/10/15, 11:13 AM - Compilation completed successfully in 5 sec
Run Code Online (Sandbox Code Playgroud)

然后我尝试将其部署到我的设备并获取:

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':app:lint'.
> Lint found errors in the project; aborting build.

  Fix the issues identified by lint, or add the following to your build script to proceed with errors:
  ...
  android {
      lintOptions {
          abortOnError false
      }
  }
Run Code Online (Sandbox Code Playgroud)

然后我看一下皮棉报告,看看:

InvalidPackage: Package not included in Android
../../../../../.gradle/caches/modules-2/files-2.1/org.roboguice/roboblender/3.0.1/d629079b9bfa8d889ec833d1eb747e89cf789bfa/roboblender-3.0.1.jar: Invalid package reference in …
Run Code Online (Sandbox Code Playgroud)

vpn proxy android gradle roboguice

9
推荐指数
1
解决办法
675
查看次数

如何将非并行junit参数化测试转换为并行运行

我写了一个参数化的junit测试.

有没有内置的方法让它并行运行?任何@annoation的例子吗?

如果没有,我唯一的方法是手动编写 -

你将如何管理junit,java中的线程池?

java testing concurrency junit multithreading

9
推荐指数
1
解决办法
4073
查看次数

安装brew后我得到`命令not found:brew`

?  ~ /usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
-e:77: warning: Insecure world writable dir /usr/local/bin in PATH, mode 040677
It appears Homebrew is already installed. If your intent is to reinstall you
should do the following before running this installer again:
    ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/uninstall)"
The current contents of /usr/local are bin CODEOFCONDUCT.md etc git lib Library LICENSE.txt munki README.md sbin share .git .github .gitignore
?  ~ brew install maven
zsh: command not found: brew
Run Code Online (Sandbox Code Playgroud)

macos terminal homebrew

9
推荐指数
15
解决办法
3万
查看次数

如何以编程方式在dp中设置EditText TopMargins?

在我的Android应用程序中,我想更改editText的topMargin.

问题是我想改变它"dp"明智而不是像素化.

我想只改变topMaring.保持原样.不把它们设置为零?

以编程方式我只能在int中设置边距?

layout android margin android-layout

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

如何实现hamcrest匹配器

我想运行这行代码:

assertThat(contextPin.get(), equalTo(pinPage.getPinObjFromUi()));

但我想打印到日志提供信息

这意味着我可以知道哪些字段不相等.

所以我想过要实现一个匹配器.

我用Google搜索了,但无法正确编写

因为我的方法无法将对象actualexpected对象组合在一起.

这是我的代码:

我该怎么写干净呢?

public class PinMatcher extends TypeSafeMatcher<Pin> {

    private Pin actual;
    private Object item;

    public PinMatcher(Pin actual) {
        this.actual = actual;
    }

    @Override
    protected boolean matchesSafely(Pin item) {
        return false;
    }

    @Override
    public void describeTo(Description description) {

    }

//cannot override this way
    @Override
    public boolean matches(Object item){
       assertThat(actual.title, equalTo(expected.title));
return true;
    }

//cannot access actual when called like this:
// assertThat(contextPin.get(), new PinMatcher.pinMatches(pinPage.getPinObjFromUi()));
    @Override
    public boolean pinMatches(Object item){ …
Run Code Online (Sandbox Code Playgroud)

java equals hamcrest matcher

7
推荐指数
2
解决办法
6786
查看次数

gson无法使用GsonBuilder.setDateFormat进行解析("yyyy-MM-dd'T'HH:mm:ss.SSSZ")

我从服务器获取此字符串:

[
 {
  "title":"spoil the ones u love today",
  "startDateTime":"2014-08-10T20:10:36.7158Z"
 },
 {
  "title":"home made patisserie",
  "startDateTime":"2014-08-10T20:08:45.0218Z"
 }
]
Run Code Online (Sandbox Code Playgroud)

我试着解析它一个对象

    public class Offer implements Serializable {
        public String title;
        public Date startDateTime;
    }

Type collectionType = new TypeToken<ArrayList<Offer>>() {}.getType();

mOffersList.addAll((Collection<? extends Offer>) gson.fromJson(result, collectionType));
Run Code Online (Sandbox Code Playgroud)

但是当我将"startDate"定义为Date时

我从gson回来的系列是空的

当我将"startDate"定义为String时

集合正确填充.

我想更改其日期格式.这就是我喜欢将它保存为Date对象的原因.

我试过了

Gson gson = new GsonBuilder().setDateFormat("yyyy-MM-dd'T'HH:mm:ss.SSSZ").create;

然而Gson无法解析服务器的字符串

Date startDateTime.没有添加任何东西mOffersList,它保持空白.

我究竟做错了什么?

java json date simpledateformat gson

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

变量 'a' 隐式具有 'any[]' 类型

我尝试npm start为我的 angular2 项目运行

但得到这个错误:

  push_quick git:(master) npm start

> angular2-quickstart@1.0.0 start /Users/eladb/WorkspaceQa/SupporTool/src/main/webapp/html/push_quick
> tsc && concurrently "tsc -w" "lite-server"

app/shared/stringUtils.service.ts(8,9): error TS7005: Variable 'a' implicitly has an 'any[]' type.

npm ERR! Darwin 15.6.0
npm ERR! argv "/usr/local/Cellar/node/6.3.1/bin/node" "/usr/local/bin/npm" "start"
npm ERR! node v6.3.1
npm ERR! npm  v3.10.3
npm ERR! code ELIFECYCLE
npm ERR! angular2-quickstart@1.0.0 start: `tsc && concurrently "tsc -w" "lite-server" `
npm ERR! Exit status 2
npm ERR!
Run Code Online (Sandbox Code Playgroud)

对于这种方法:

@Injectable()
export class StringUtilsService {

  mapToFormParamsString( dict …
Run Code Online (Sandbox Code Playgroud)

typescript angular

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

即使存在主类,gradle“未指定主类”

我尝试运行此 gradle 任务:

task resources_cleaner_bl(type: JavaExec) {
    classpath sourceSets.main.runtimeClasspath
    systemProperties['cleanTarget'] = 'bl'
    mainClassName = "com.w.routing.automation.runners.cleaner.ResourcesCleanerRunner"
}
Run Code Online (Sandbox Code Playgroud)

使用此 Java 代码:

package com.w.routing.automation.runners.cleaner;

public class ResourcesCleanerRunner {


    private static IResourcesCleaner resourcesCleaner;
    private static Injector injector;


    public static void main(String args[]) {
        init();
        String cleanTarget = System.getProperty("cleanTarget");
        switch (cleanTarget) {
Run Code Online (Sandbox Code Playgroud)

但我收到此错误:

15:48:06.532 [ERROR] [org.gradle.BuildExceptionReporter] FAILURE: Build failed with an exception.
15:48:06.533 [ERROR] [org.gradle.BuildExceptionReporter] 
15:48:06.549 [ERROR] [org.gradle.BuildExceptionReporter] * What went wrong:
15:48:06.549 [ERROR] [org.gradle.BuildExceptionReporter] Execution failed for task ':resources_cleaner_bl'.
15:48:06.549 [ERROR] [org.gradle.BuildExceptionReporter] > No …
Run Code Online (Sandbox Code Playgroud)

java gradle

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

詹金斯忽视"包容性地区"

我有两个jenkins项目

1)一个轮询git repo的人

2)第二个触发java应用程序

我想配置(1)仅对特定文件进行轮询,所以我在"包含区域"下进行了轮询.但是,我看到在回购中的每次更改后都会触发项目,而不仅仅是在更改特定文件时.

有谁经历过同样的经历?

其他工作?

在此输入图像描述

git jenkins

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