小编Joh*_*ley的帖子

Android Annotations找不到AndroidManifest.xml

我已经检查了几个不同的问题,但没有一个提供适合我的解决方案.我正在使用Android Annotations开发一个项目,当我尝试构建我的项目时,它失败并出现以下错误(Project_Location只是我的本地项目文件夹):

错误:无法在指定路径中找到AndroidManifest.xml文件:[/ Project_Location/mobile/build/intermediates/manifests/full/debug/AndroidManifest.xml]

这是我的移动build.gradle文件:

apply plugin: 'com.android.application'

ext.androidAnnotationsVersion = '3.3.2';
ext.eventBusVersion = '2.4.0';

buildscript {
    repositories {
        jcenter()
    }
    dependencies {
        classpath 'com.neenbedankt.gradle.plugins:android-apt:1.4'
    }
}

apply plugin: 'android-apt'

dependencies {
    compile fileTree(include: ['*.jar'], dir: 'libs')
    wearApp project(':wear')
    compile 'com.android.support:appcompat-v7:23.1.1'
    compile 'com.google.android.gms:play-services:8.3.0'
    apt "org.androidannotations:androidannotations:${androidAnnotationsVersion}"
    compile "org.androidannotations:androidannotations:${androidAnnotationsVersion}"
    apt "de.greenrobot:eventbus:${eventBusVersion}"
    compile "de.greenrobot:eventbus:${eventBusVersion}"
}

android {
    compileSdkVersion 23
    buildToolsVersion "23.0.1"

    defaultConfig {
        applicationId "com.dev.app_name"
        minSdkVersion 16
        targetSdkVersion 23
        versionCode 1
        versionName "0.3"
    }
    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        } …
Run Code Online (Sandbox Code Playgroud)

android android-manifest android-annotations build.gradle android-gradle-plugin

5
推荐指数
1
解决办法
3015
查看次数

AWS CLI 无效 JSON 错误 - 需要用双引号括起来的属性名称

我正在用 javascript 编写一个依赖 AWS 的应用程序,我正在使用 AWS CLI 来自动化我的 AWS 资源的构建过程。我正在尝试创建一个启用了 CORS 的 API 网关资源。在调用put-integration-responseapi网关CLI的方法时,当我添加--response-parameters参数时,收到以下错误:

>> Error parsing parameter '--response-parameters': Invalid JSON: Expecting property name enclosed in double quotes: line 1 column 2 (char 1)
>> JSON received: {method.response.header.Access-Control-Allow-Origin:'*'}
Run Code Online (Sandbox Code Playgroud)

这是导致问题的 --response-parameters 参数:

--response-parameters {"method.response.header.Access-Control-Allow-Origin":"\'*\'"}

如果有帮助,这个参数是通过 Grunt 的 grunt-exec 插件提供的。究竟是什么导致了这个问题?我尝试添加更多双引号,但它们似乎没有出现在“收到的 JSON”中。

javascript json amazon-web-services aws-cli aws-api-gateway

5
推荐指数
2
解决办法
8384
查看次数

Android Instrumented单元测试中的上下文和资源

我正在设计一个带有一些不太简单的类的系统,这些类需要一个Context对象才能对其进行初始化。这些类使用第三方类,它们也需要上下文初始化。该类还利用上下文加载功能所需的许多字符串资源。

问题在于为这些类编写仪表单元测试。当我尝试使用InstrumentationRegistry.getContext()获取用于测试的Context对象时,遇到了一个异常,即上下文找不到与该类关联的字符串资源(android.content.res.Resources $ NotFoundException)。

我的问题是:如何设计这些测试,以便上下文可以检索我需要的字符串资源,还可以用作第三方类的合适上下文对象?我只能做很多模拟,因为其中一些类可以处理auth令牌,这很难模拟。在Android域中,我不是唯一一个遇到此问题的人,所以我敢肯定,对于这个普遍存在的问题,有一个通用的解决方案。

编辑:按照建议,我已经尝试在项目中集成Robolectric(版本3.3.2),但是当我尝试运行单元测试时,遇到以下错误:

Error:Error converting bytecode to dex:
Cause: Dex cannot parse version 52 byte code.
This is caused by library dependencies that have been compiled using Java 8 or above.
If you are using the 'java' gradle plugin in a library submodule add 
targetCompatibility = '1.7'
sourceCompatibility = '1.7'
to that submodule's build.gradle file. 
Run Code Online (Sandbox Code Playgroud)

我尝试将targetCompatibility和sourceCompatibility行添加到我的gradle文件中(在几个位置)无济于事。

这是我的手机build.gradle:

apply plugin: 'com.android.application'
apply plugin: 'checkstyle'
apply plugin: 'io.fabric'

project.ext {
    supportLibVersion = '25.3.0'
    multiDexSupportVersion = '1.0.1'
    gsonVersion …
Run Code Online (Sandbox Code Playgroud)

junit android unit-testing android-context android-resources

4
推荐指数
1
解决办法
914
查看次数

ExcelJS writeFile 不起作用:未捕获类型错误:fs.createWriteStream 不是函数

我正在尝试使用 ExcelJS 导出格式化的 Excel 文件,但 writeFile 方法根本不起作用。当我调用该函数时,出现以下异常:

Uncaught TypeError: fs.createWriteStream is not a function

我的 javascript 是使用 browserify.js 捆绑的。这是我的源代码:

索引.html

<!DOCTYPE html>
<head>
  <title>Test Excel JS</title>
  <meta charset="utf-8">
  <meta name="description" content="">

  <link rel="stylesheet" href="app.css">
</head>
<body>
  <div>
    <label>Test</label>
    <button onclick="test()">Test this Stuff and Check your console log</button>
  </div>

  <script src="bundle.js"></script>
  <script>
      var test = function(){
          writeFile();
      };
  </script>
</body>
</html>
Run Code Online (Sandbox Code Playgroud)

app.js(由 browserify 捆绑到bundle.js)

'use strict';

global.Excel = require('../node_modules/exceljs/dist/es5/exceljs.browser');

global.isRowBold = function(excelRow){
    return excelRow.getCell('name').value === "Jeff";
};

global.getRowColor = function(excelRow){
    return …
Run Code Online (Sandbox Code Playgroud)

javascript xlsx node.js exceljs

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