我一直在尝试在我的android项目中设置firebase.问题是,我一直得到这个错误:无法解析android应用程序模块的Gradle配置...我真的无法解决它.
我见过很多人遇到这个错误,但似乎他们可以通过升级他们的构建工具版本或更新google-services来解决它.我已经做了所有这些,到目前为止还没能使它工作.
这是我的gradle脚本:
apply plugin: 'com.android.application'
android {
signingConfigs {
AndroidAppPro {
}
}
compileSdkVersion 25
buildToolsVersion '26.0.0'
useLibrary 'org.apache.http.legacy'
defaultConfig {
applicationId "com.critizr.pro"
minSdkVersion 14
targetSdkVersion 25
versionCode 9
versionName "1.5.1"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.txt'
}
}
productFlavors {
preprod {
applicationId "com.cr.pro"
buildConfigField 'boolean', 'IS_PROD', 'false'
buildConfigField 'String', 'HOST', '"https://myurl.com/"'
}
prod {
applicationId "com.cr.pro"
buildConfigField 'boolean', 'IS_PROD', 'true'
buildConfigField 'String', 'HOST', '"https://myurl/"'
}
}
packagingOptions {
exclude 'META-INF/DEPENDENCIES.txt'
exclude 'META-INF/LICENSE.txt'
exclude …Run Code Online (Sandbox Code Playgroud) 我正在使用护照来保护我的API.我很难理解如果发生错误我应该如何发回自定义消息,我希望在这里找到答案.
这是我做的:
路由(server.js):
router.route('/Applications').get(authController.BearerAuthenticated, applicationController.getApplications);
Run Code Online (Sandbox Code Playgroud)
我的Passport Stuff(authController.js):
Passport.use(new BearerStrategy(function(token, cb) {
Token.findOne({token: token}, function(err, token){
if (err){return cb(null, false);}
if (!token) { return cb(null, false); }
return cb(null, token);
});
}));
exports.BearerAuthenticated = Passport.authenticate('bearer', {session: false});
Run Code Online (Sandbox Code Playgroud)
我的应用方法(Application.js)
exports.getApplications = function(req, res) {
Application.find({userId:req.user._id}, function(err, apps) {
if (err)
res.send(err);
res.json(apps);
});
};
Run Code Online (Sandbox Code Playgroud)
如果我的令牌有效且承载方法返回
return cb(null, token);
Run Code Online (Sandbox Code Playgroud)
然后我可以输入我的getApplications方法.这说得通.
问题是当令牌无效时,我不输入方法(也有意义)但我无法想出一种方法将自定义消息返回给客户端而不是默认情况下我得到的以下消息.
Unauthorized
Run Code Online (Sandbox Code Playgroud)
什么是返回带有错误代码的Json以正确地让用户知道他的令牌已经死亡或根本不存在的方法?
谢谢你的时间.:)
我目前正在使用elasticsearch,logstash和kibana.
我得到一个我无法通过的例外.
首先,这是我在浏览器中输入ip:9200/_cluster/health时得到的内容..
{
"cluster_name":"mr-cluster",
"status":"yellow",
"timed_out":false,
"number_of_nodes":1,
"number_of_data_nodes":1,
"active_primary_shards":5,
"active_shards":5,
"relocating_shards":0,
"initializing_shards":0,
"unassigned_shards":5
}
Run Code Online (Sandbox Code Playgroud)
以下是kibana在尝试请求弹性搜索时获得的内容
Remote Address:ip:9200
Request ip:9200/_all/_search
Request Method:POST
Status Code:200 OK
Run Code Online (Sandbox Code Playgroud)
到现在为止似乎没问题..
这是我的logstash配置文件:
input {
gelf {
port => "5000"
}
udp {
port => "5001"
}
}
output {
file {
path => "/home/g/stdout.log"
}
elasticsearch {
cluster => "mr-cluster"
codec => "json"
}
}
Run Code Online (Sandbox Code Playgroud)
当我只使用一个文件作为输出时它非常简单,它可以很好地工作,logstash工作.问题是,当我想使用elasticsearch作为输出时,没有任何东西可以工作(事件文件输出),我从elasticsearch获得此异常.我一直在谷歌搜索几个小时,但没有找到解决方案.
这是一个例外:
[2014-05-21 09:18:35,060][WARN ][http.netty ] [mr-node-elasticsearch] Caught exception while handling client http traffic, closing connection [id: 0x27d0ccce, /0:0:0:0:0:0:0:1:44164 => …Run Code Online (Sandbox Code Playgroud) 我在使用SQLite时遇到了问题.当我试图生成我的查询时,这是我遇到的错误.
03-05 11:40:54.916: E/AndroidRuntime(6136): Caused by: android.database.sqlite.SQLiteException: near "@domain": syntax error (code 1): , while compiling: SELECT * FROM shopping_list WHERE shopping_list_owner = mail@domain.fr
Run Code Online (Sandbox Code Playgroud)
这是查询原始的函数:
public List<ShoppingListModel> getAllShoppingListByOwner(String owner) {
List<ShoppingListModel> shoppingList = new ArrayList<ShoppingListModel>();
String selectQuery = "SELECT * FROM " + TABLE_SHOPPING_LIST + " WHERE " + SHOPPING_LIST_OWNER + " = " + owner;
SQLiteDatabase db = this.getWritableDatabase();
Cursor cursor = db.rawQuery(selectQuery, null);
if (cursor.moveToFirst()) {
do {
ShoppingListModel list = new ShoppingListModel(cursor.getString(cursor.getColumnIndex(SHOPPING_LIST_NAME)),
cursor.getInt(cursor.getColumnIndex(SHOPPING_LIST_ID)),
cursor.getString(cursor.getColumnIndex(SHOPPING_LIST_DATE_CREATION)),
cursor.getString(cursor.getColumnIndex(SHOPPING_LIST_OWNER)));
shoppingList.add(list);
} …Run Code Online (Sandbox Code Playgroud) 我正在做一个项目并完成它我需要做一些比较double,float ...问题是当我比较两个double,它们分别是double的最大值和double + 1的最大值,比较失败......我做
if (std::max(d_max + 1.1, (d_max)) == d_max)
std::cout << "bad" << std::endl;
Run Code Online (Sandbox Code Playgroud)
函数max的答案是d_max并显示"bad"......是否有人有想法或解决方案来获得我的比较的精确度?我检查谷歌,但我发现了更多的解释,而不是真正解决我的问题...非常感谢!
在使用 AppLinks for Android 为我的应用程序开发功能时。我意识到它实际上可以在不使用 assetlinks.json 文件的情况下工作。
起初,我认为这是因为我的应用程序是用于调试目的的应用程序,没有通过商店签名和发布,出于测试目的,谷歌决定给我们一些工作空间。
我发布应用程序的那一天到了,我将我的应用程序通过 Beta 版,从商店安装我的应用程序并点击https://example.com,我很惊讶地看到我被问到我想打开哪个应用程序URL,即使我没有从https://example.com/.well-known/assetlink.json提供 assetlinks.json 。
对此有解释吗?也许检查是完全异步的,如果在某个时候 Google 进行检查并发现您没有这个文件,他们会关闭它,直到您修复它,而您必须等到下一次他们检查您?
顺便说一句,我已经在 iOS 上实现了相同的功能,并且以一种非常苹果风格的方式,你真的无法绕过将你的 apple-app-site-association 文件放在正确的位置并使其从正确的端点可用.
感谢您的解释 :)
纪尧姆。
android ×3
bearer-token ×1
c++ ×1
comparison ×1
deep-linking ×1
double ×1
firebase ×1
gradle ×1
kibana ×1
logstash ×1
node.js ×1
passport.js ×1
rest ×1
sqlite ×1