我无法通过手机登录。我只在Android Studio中收到此错误:
11-01 03:28:56.427 24227-24375 / com.example.segall.caveofprogcourse E / GED:无法获得GED Log Buf,错误(0)
Android studio 2.1.3
Ubuntu 16.04 LTS
索尼Xperia M5
android 6.0 api 23
我有USB调试。
修改
onCreate方法中的代码
var express = require('express');
var router = express.Router();
var passport = require('passport');
var LocalStrategy = require('passport-local').Strategy;
var User = require('../models/user');
/* GET users listing. */
router.get('/', function(req, res, next) {
res.send('respond with a resource');
});
router.get('/register', function(req, res, next) {
res.render('register',{
'title': 'Register'
});
});
router.get('/login', function(req, res, next) {
res.render('login',{
'title': 'Login'
});
});
router.post('/register', function(req, res, next){
// Get Form Values
var name = req.body.name;
var email = req.body.email;
var username = req.body.username;
var password = req.body.password;
var password2 = req.body.password2;
// Check for Image Field
if(req.files && req.files.profileimage){
console.log('Uploading File...');
// File Info
var profileImageOriginalName = req.files.profileimage.originalname;
var profileImageName = req.files.profileimage.name;
var profileImageMime = req.files.profileimage.mimetype;
var profileImagePath = req.files.profileimage.path;
var profileImageExt = req.files.profileimage.extension;
var profileImageSize = req.files.profileimage.size;
} else {
// Set a Default Image
var profileImageName = 'noimage.png';
}
// Form Validation
req.checkBody('name','Name field is required').notEmpty();
req.checkBody('email','Email field is required').notEmpty();
req.checkBody('email','Email not valid').isEmail();
req.checkBody('username','Username field is required').notEmpty();
req.checkBody('password','Password field is required').notEmpty();
req.checkBody('password2','Passwords do not match').equals(req.body.password);
// Check for Errors
var errors = req.validationErrors();
if(errors){
res.render('register',{
errors: errors,
name: name,
email: email,
username: username,
password: password,
password2: password2
});
} else {
var newUser = new User({
name: name,
email: email,
username: username,
password: password,
profileimage: profileImageName
});
// Create User
User.createUser(newUser, function(err, user){
if(err) throw err;
console.log(user);
});
User.createUser(newUser, function(err, user){
if(err) throw err;
console.log(user);
});
// Success Message
req.flash('success', 'You are now registered and may log in');
res.location('/');
res.redirect('/');
}
});
passport.serializeUser(function(user, done) {
done(null, user.id);
});
passport.deserializeUser(function(id, done) {
User.getUserByUsername(id, function(err, user) {
done(err, user);
});
});
passport.use(new LocalStrategy(
function(username, password, done){
User.getUserByUsername(username, function(err, user){
if(err)throw err;
if(!user){
console.log('Unknown User');
return done(null, false,{message: 'Unknown User'});
}
User.comparePassword(password, user.password, function(err, isMatch){
if(err) throw err;
if(isMatch){
return done(null, user);
} else {
console.log('Invalid Password');
return done(null, false, {message: 'Invalid Password'});
}
});
});
}
));
router.post('/login', passport.authenticate('local', {failureRedirect: '/users/login', failureFlash:'Invalid username or password'}), function(req, res){
console.log('Authentication Successful');
req.flash('success', 'You are logged in');
res.redirect('/');
});
router.get('/logout', function(req, res){
req.logout();
req.flash('success', 'You have logged out');
res.redirect('/users/login');
});
module.exports = router;
获得以下结果:
Log.d("mylog", " LOG WORKS ");
Log.e("mylog", "onCreate called really?"); // I added this Log
令人惊讶的是,Log.e有效。任何人都知道为什么会发生这种情况?
编辑2 我只使用onCreate
中的两个日志创建了新项目11-01 21:51:23.561 7820-7820/com.example.segall.caveofprogcourse E/mylog: onCreate called really?
11-01 21:51:23.619 7820-7873/com.example.segall.caveofprogcourse E/GED: Failed to get GED Log Buf, err(0)
我放了一些空行,所以很容易发现
来自app的日志过滤器:
Log.d("mylog","Log.d on create this is not working");
Log.e("mylog","Log.e surprisingly this works");
日志过滤器没有过滤器:
11-02 02:24:08.858 24802-24802/com.example.segall.logapp W/ResourceType: Found multiple library tables, ignoring...
11-02 02:24:08.863 24802-24802/com.example.segall.logapp W/System: ClassLoader referenced unknown path: /data/app/com.example.segall.logapp-1/lib/arm64
11-02 02:24:08.885 24802-24811/com.example.segall.logapp I/System: FinalizerDaemon: finalize objects = 1
11-02 02:24:09.038 24802-24802/com.example.segall.logapp W/System: ClassLoader referenced unknown path: /data/app/com.example.segall.logapp-1/lib/arm64
11-02 02:24:09.180 24802-24802/com.example.segall.logapp W/art: Before Android 4.1, method android.graphics.PorterDuffColorFilter android.support.graphics.drawable.VectorDrawableCompat.updateTintFilter(android.graphics.PorterDuffColorFilter, android.content.res.ColorStateList, android.graphics.PorterDuff$Mode) would have incorrectly overridden the package-private method in android.graphics.drawable.Drawable
11-02 02:24:09.366 24802-24802/com.example.segall.logapp E/mylog: Log.e surprisingly this works
11-02 02:24:09.435 24802-24833/com.example.segall.logapp E/GED: Failed to get GED Log Buf, err(0)
11-02 02:24:09.439 24802-24833/com.example.segall.logapp I/OpenGLRenderer: Initialized EGL, version 1.4
11-02 02:24:09.448 24802-24833/com.example.segall.logapp I/OpenGLRenderer: Get enable program binary service property (1)
11-02 02:24:09.448 24802-24833/com.example.segall.logapp I/OpenGLRenderer: Initializing program atlas...
11-02 02:24:09.449 24802-24833/com.example.segall.logapp I/OpenGLRenderer: Program binary detail: Binary length is 360191, program map length is 152.
11-02 02:24:09.449 24802-24833/com.example.segall.logapp I/OpenGLRenderer: Succeeded to mmap program binaries. File descriptor is 38, and path is /dev/ashmem�.
11-02 02:24:09.449 24802-24833/com.example.segall.logapp I/OpenGLRenderer: No need to use file discriptor anymore, close fd(38).
11-02 02:24:09.452 24802-24833/com.example.segall.logapp W/libEGL: [ANDROID_RECORDABLE] format: 1
11-02 02:24:09.569 24802-24802/com.example.segall.logapp I/Timeline: Timeline: Activity_idle id: android.os.BinderProxy@aec4c2c time:73133463
答案 0 :(得分:0)
答案 1 :(得分:0)
我有同样的问题。请更新您的Android Studio。这是一个错误
答案 2 :(得分:-1)
使用Linux(Ubuntu),您已设置系统以检测设备。您可以查看这些Google guidelines
您需要为要用于开发的每种类型的设备添加包含udev rules
的{{1}}文件。
在执行此操作之前,请确认您的应用程序是"可调试的"在您的清单或USB configuration
文件中。
build.gradle
在 android {
buildTypes {
debug {
debuggable true
}
文件中,将AndroidManifest.xml
添加到android:debuggable="true"
元素。
现在设置系统以使用 udev规则文件检测您的设备。添加udev规则文件,其中包含要用于开发的每种类型设备的USB配置。在规则文件中,每个设备制造商都由唯一的供应商ID标识,由<application>
属性指定。因此,您必须了解Sonys供应商ID:ATTR{idVendor}
054c
即
/etc/udev/rules.d/51-android.rules
使用此格式将每个供应商添加到文件中:054c是sonys供应商ID。
sudo gedit /etc/udev/rules.d/51-android.rules
如果你添加SUBSYSTEM=="usb", ATTR{idVendor}=="054c", MODE="0666", GROUP="plugdev"
Android工作室将检测索尼。
SUBSYSTEM=="usb", ATTR{idVendor}=="054c", MODE="0666", GROUP="plugdev"
关闭并启动Studio。然后运行您的项目。 Studio会检测到它