小编NLa*_*Lam的帖子

构建脚本错误,找不到支持的Gradle DSL方法:'signingConfig()'

我正在尝试设置gradle以在Android Studio 0.4.5中创建Google Play商店版本.在gradle设置中,我使用默认的gradle包装器.我使用Project Properties对话框来设置签名配置和'release'构建类型.我只有一个构建模块.以下是生成的build.gradle文件:

    apply plugin: 'android'

android {
    compileSdkVersion 19
    buildToolsVersion '19.0.1'
    defaultConfig {
        minSdkVersion 15
        targetSdkVersion 19
        versionCode 10
        versionName "1.0"
    }
    buildTypes {
        release {
            runProguard true
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.txt'
            debuggable false
            signingConfig playstore
            proguardFile 'proguard-rules.txt'
        }
    }
    signingConfigs {
            playstore {
            keyAlias 'mykeyalias'
            storeFile file('playstore.jks')
            keyPassword 'xxxxx'
            storePassword 'xxxxx'
        }
    }
}

dependencies {
    compile fileTree(dir: 'libs', include: ['*.jar', '*.aar'])
    compile 'com.android.support:support-v4:+'
    compile files('libs/libGoogleAnalyticsServices.jar')
}
Run Code Online (Sandbox Code Playgroud)

但是当gradle尝试同步时,我收到以下错误:

Build script error, unsupported Gradle DSL method found: 'signingConfig()'! …
Run Code Online (Sandbox Code Playgroud)

gradle android-studio

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

在Android Studio导入期间维护目录结构

我克隆了一个公共github存储库,并尝试将其导入Android Studio 0.4.4.导入工作很好,但它想将所有源复制到新目录并为源创建"app"目录.由于我使用的是公共存储库,因此我想使用repo克隆目录并保持目录结构,这样我就可以获得更新并推送更改,而无需每个方向复制文件.

有没有办法告诉Android Studio在导入时保持给定的目录结构?

或者,换句话说,有没有办法跳过gradle转换并按原样导入源?

Thanx提前.

git import gradle android-studio

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

错误:找不到模块“../lib/tslint-cli”

我正在尝试创建我的第一个 Firestore Cloud Function,并完成了入门说明。但是当我尝试部署 Hello World 脚本时,出现以下错误:

=== Deploying to 'myproject-dev'...

i  deploying functions
Running command: npm --prefix "$RESOURCE_DIR" run lint

> functions@ lint /Users/nlam/Dropbox/dev/myproject/backend/functions
> tslint --project tsconfig.json

module.js:549
    throw err;
    ^

Error: Cannot find module '../lib/tslint-cli'
    at Function.Module._resolveFilename (module.js:547:15)
    at Function.Module._load (module.js:474:25)
    at Module.require (module.js:596:17)
    at require (internal/module.js:11:18)
    at Object.<anonymous> (/Users/nlam/Dropbox/dev/myproject/backend/functions/node_modules/.bin/tslint:3:1)
    at Module._compile (module.js:652:30)
    at Object.Module._extensions..js (module.js:663:10)
    at Module.load (module.js:565:32)
    at tryModuleLoad (module.js:505:12)
    at Function.Module._load (module.js:497:3)
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! …
Run Code Online (Sandbox Code Playgroud)

tslint google-cloud-functions

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

来自不同集合的条件的 Firestore 规则

我有一个包含两个集合的 Firestore 数据库:用户和锦标赛。用户具有“参与者”角色和“管理员”角色,并由用户文档中的“isParticipant”和“isAdmin”布尔值指示:

/users/{userId}:
  isParticipant: true
  isAdmin: true
Run Code Online (Sandbox Code Playgroud)

我为这些集合设置了访问规则,如下所示:

service cloud.firestore {
  match /databases/{database}/documents {
     match /users/{userId} {
      allow create, read;
      allow update: if request.auth.uid == userId;
    }
     match /tournaments/{tournamentId} {
      allow create, read, update: if request.auth.uid != null;
    }
  }
}
Run Code Online (Sandbox Code Playgroud)

但是,我真正想做的是将锦标赛的创建限制为具有“管理员”角色的用户。我已经在代码中这样做了,但希望增加 db 规则的安全性,以防止除管理员用户之外的任何人创建锦标赛。

有没有办法在规则语法中引用不同集合的数据元素?就像是:

     match /tournaments/{tournamentId} {
      allow create: if resources.users.userId.isAdmin == true;
    }
Run Code Online (Sandbox Code Playgroud)

?

提前致谢。

firebase-security google-cloud-firestore

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