Android issues
1. Android studio 2.0
Error:Exception in thread "main" java.lang.UnsupportedClassVersionError: com/android/dx/command/Main : Unsupported major.minor version 52.0
解决办法:http://stackoverflow.com/questions/35990995/com-android-dx-command-main-unsupported-major-minor-version-52-0
// buildToolsVersion "24.0.0 rc3"
buildToolsVersion "23.0.2"
2. Manifests 权限已经设置,仍然有权限问题(Permission denied (missing INTERNET permission?) )
Permission denied (missing INTERNET permission?): But permission is given
<uses-permission android:name="android.permission.INTERNET" /> <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" /> <uses-permission android:name="android.permission.ACCESS_WIFI_STATE" /> <uses-permission android:name="android.permission.CHANGE_WIFI_STATE" /> <uses-permission android:name="android.permission.CHANGE_NETWORK_STATE" /> <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" /> <application ...> </application>
android.database.sqlite.SQLiteCantOpenDatabaseException: unknown error (code 14): Could not open database
code:
try { String packageName="";//getPackageName(); SQLiteDatabase.openOrCreateDatabase("/data/data/"+packageName+"/databases/test1.db", null); Log.v("killed", "DB created"); } catch (Exception e) { Log.e("killed", "Create DB Error" + e.getMessage()); }
permission:
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
出现这个问题,首先检查一下读写权限,发现权限没问题,一直这样的问题,在网上也查了许多,没有一个靠谱的。
最后才发现该db文件,只有在/data/data/packagename/目录下才有权限, 如果你出现这样的问题,只需要吧路径设置到相应app package下面
Details:
Order of defining tabs in Manifest:
- Permissions
- Applications
- Receiver, Service, Metadata
3.AS 2.0 开启Instant Run出现的问题:Error:Access to the dex task is now impossible, starting with 1.4.0
Error:Access to the dex task is now impossible, starting with 1.4.0
1.4.0 introduces a new Transform API allowing manipulation of the .class files.
See more information: http://tools.android.com/tech-docs/new-build-system/transform-api
android老项目倒入后,android studio 2.0 自动更新gradle到2.0.0
http://blog.csdn.net/yzpbright/article/details/51231826
4. Android Fragment
The method add(Fragment,String ) in the type FragmentTransaction is not applicable for the arguments (int, MyFragment)
import issue,
今天遇到这样一个很奇葩的错误信息,后来查到我导入的包有问题 import android.app.Fragment;
import android.app.FragmentManager; 其实我应该使用的是 import android.support.v4.app.Fragment;
import android.support.v4.app.FragmentManager; 然后自己查看了一下API二者差别还是蛮大的 import android.app.Fragment 只能在API版本大于11的时候使用 而不包含getFragmentManager() 和 getSupportFragmentManager()
两个方法的 虽然在代码这样写不会报错的 但是 replace(int, Fragment, String)执行的时候会一直出现错误 提示上面那个错误信息
5. Error:(100, 43) error: package R does not exist
import yourpackage.R
6. android.content.res.Resources$NotFoundException: String resource ID #0x1
今天使用TextView的setText方法遇到这个错误,原来是传入text的是int类型的,android不能自动转换成string类型,直接跑出这样的异常,我也是醉了
7. Android listview set on click item listener doesn't work
Item Layout的根控件设置其Android:descendantFocusability=”blocksDescendants”即可
8 include exception
You must specifiy a layout in the include tag: <include layout="@layout/layoutID" />
layout.xml
android:layout=" xxx"
remove android

【推荐】国内首个AI IDE,深度理解中文开发场景,立即下载体验Trae
【推荐】编程新体验,更懂你的AI,立即体验豆包MarsCode编程助手
【推荐】抖音旗下AI助手豆包,你的智能百科全书,全免费不限次数
【推荐】轻量又高性能的 SSH 工具 IShell:AI 加持,快人一步
· AI与.NET技术实操系列(二):开始使用ML.NET
· 记一次.NET内存居高不下排查解决与启示
· 探究高空视频全景AR技术的实现原理
· 理解Rust引用及其生命周期标识(上)
· 浏览器原生「磁吸」效果!Anchor Positioning 锚点定位神器解析
· DeepSeek 开源周回顾「GitHub 热点速览」
· 物流快递公司核心技术能力-地址解析分单基础技术分享
· .NET 10首个预览版发布:重大改进与新特性概览!
· AI与.NET技术实操系列(二):开始使用ML.NET
· 单线程的Redis速度为什么快?
2014-04-16 perl Can't use string Cxxx) as a symbol ref while "strict refs" in use at XXXX.pl错误