赞
踩
打开a s工程项目,报错:Could not find method android() for arguments
Error:(31, 0) Could not find method android() for arguments [build_4g5zqa4pkpj6q6qii8a22khzz$_run_closure2@7a96d128] on root project 'Mybaby' of type org.gradle.api.Project.
<a href="openFile:/Users/shixinshan/Development/ReactNativeProjects/Mybaby/android/build.gradle">Open File</a>
点击“Open File”–>注释掉,如下代码:
//android {
// compileSdkVersion 25
// buildToolsVersion '25.0.2'
//}
打开as项目,报错:No cached version of com.android.tools.build:gradle:2.2+ available for offline mode.
No cached version of com.android.tools.build:gradle:2.2+ available for offline mode.
Preferences-->搜索“gradle”-->取消勾选的Offline Work, -->点击"Apply"-->AS会自动下载
在编译as项目时候,报错:
D:\AndroidStudioProjects\\app\build\intermediates\res\merged\debug\values-ldltr-v21\values-ldltr-v21.xml
Error:(19) Error retrieving parent for item: No resource found that matches the given name 'android:TextAppearance.Material.Large.Inverse'.
Error:(32) Error retrieving parent for item: No resource found that matches the given name 'android:TextAppearance.Material.Small.Inverse'.
Error:(3) Error retrieving parent for item: No resource found that matches the given name 'android:Widget.Material.Spinner.Underlined'.
Error:(3) Error retrieving parent for item: No resource found that matches the given name 'android:Widget.Material.Spinner.Underlined'.
Error:(176) Error retrieving parent for item: No resource found that matches the given name 'android:Widget.Material.AutoCompleteTextView'.
D:\AndroidStudioProjects\app\build\intermediates\res\merged\debug\values-v21\values-v21.xml
Error:(25) Error retrieving parent for item: No resource found that matches the given name 'android:TextAppearance.Material.Medium.Inverse'.
Error:(17) Error retrieving parent for item: No resource found that matches the given name 'android:TextAppearance.Material.Inverse'.
Error:(218) Error retrieving parent for item: No resource found that matches the given name 'android:Widget.Material.ProgressBar.Horizontal'.
Error:(216) Error retrieving parent for item: No resource found that matches the given name 'android:Widget.Material.ProgressBar'.
。。。
。。。
打开app目录下的build.gradle文件,查看里面的compileSdkVersion
和compile ‘com.android.support:’版本是不是对应的,如果不对应修改改成一样。比如:
apply plugin: 'com.android.application'
android {
compileSdkVersion 19
buildToolsVersion "25.0.2"
defaultConfig {
applicationId "com.smart.smartpadsdkdemo"
minSdkVersion 14
targetSdkVersion 19
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.txt'
}
}
compileOptions {
encoding "UTF-8"
}
}
tasks.withType(JavaCompile) {
options.encoding = "UTF-8"
}
dependencies {
compile('com.github.tony19:logback-android-classic:1.1.1-6') {
exclude group: 'com.google.android', module: 'android'
}
compile 'com.android.support:support-v4:19.1.0'
compile 'com.google.code.gson:gson:2.2.4'
compile 'com.android.support:appcompat-v7:19.1.0'
}
使用adb shell报错:
adb server is out of date. killing
解决方法:
原因可能是其它程序占用了5037端口导致的,
所以查看哪个程序占用了adb调试端口,然后结束掉它就行。
点击android studio工具下方的Terminal,输入下面三条指令
//查看使用5037端口有哪些应用占用
netstat -aon|findstr "5037"
//查看具体端口是那个应用占用
tasklist|findstr "5456"
//杀死xxxx端口的应用
taskkill /f /pid xxxx
如果上面的方法还是不行,继续下面步骤
cmd命令行输入adb devices
List of devices attached
没有显示设备,说明电脑没有连接到手机设备
解决方法:下载豌豆荚软件,连接手机,让电脑能够连接到手机
再cmd命令行输入adb devices,显示如下结果,说明连接成功
List of devices attached
87209cd8c6a700000000 device
问题:打开Android Devices Monitor工具,发现Data目录打不开
分析:没有访问权限,普及一下, drwxrwx–x,这玩意是什么意思呢?
这9 个字符可以分为三组,
如何修改Data目录的权限?
D:\AndroidStudioProjects\SmartTeachAttendance>adb shell
shell@astar-dvk3:/ $ su
su
shell@astar-dvk3:/ # chmod 777 /data
chmod 777 /data
shell@astar-dvk3:/ # chmod 777 /data/data
chmod 777 /data/data
shell@astar-dvk3:/ # chmod 777 /data/data/com.smart.teach
chmod 777 /data/data/com.smart.teach
shell@astar-dvk3:/ # chmod 777 /data/data/com.smart.teach/databases
chmod 777 /data/data/com.smart.teach/databases
shell@astar-dvk3:/ # chmod 777 /data/data/com.smart.teach/databases/*
chmod 777 /data/data/com.smart.teach/databases/*
shell@astar-dvk3:/ #
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。