android开发-关于数据库Could not open的解决方法
(三)Apk改之理(Apk IDE)使用常见问题~~~!

1.如何配置Java SDK?鉴于还有很多人不明白如何设置JDK,这里以安装jdk1.6为例,给出一个详细设置步骤:(1)先下载安装JDK1.6:点击这里进入下载JDK6,参考下面的图示下载jdk安装包(点击图片看大图)。
下载jdk1.6本帖隐藏的内容(2)安装jdk1.6,安装时注意它的安装路径,你也可以更改安装路径,假设安装路径为E:\Develop\JDK6。
安装时有二个部份选择安装,一个是JDK,一个是JRE(建议都装),二者的路径可以设置不同,主要是JDK的路径你记得最好,至于JRE随便装哪儿,不过建议都放在一起(如安装到E:\Develop\JDK6\jre,覆盖同名目录没什么问题)。
(PS:安装过程就不详述了,如果连安装都不会,我只能建议你先去学一些电脑的基本知识)(3)如果你照上面的步骤做的,重新打开APK改之理后,它一般就能直接找到JDK的安装路径了,不用再手动配置。
(4)如果没有自动配置好,或者你使用的是免安装绿色版的JDK,你可以手动配置JavaSDK 方法:在APK改之理主界面点菜单“工具-配置SDK”,点击“Java SDK(JDK)”安装路径后面的“浏览”按钮,找到JDK的安装目录(这个示例中就是E:\Develop\JDK6)。
(PS:如果你被提示“无效的安装目录”,若如此,请确保你所选择的目录下存在一个bin文件夹,且这个bin文件夹下包含java.exe、jarsigner.exe等程序。
)【注意】从2.4版开始不再支持jre,必须要jdk,因为jre相对jdk少了很多工具(如jre的bin目录下没有jarsigner.exe等),随着APK改之理的不断升级,有可能用到jdk中的更多工具,所以从2.4开始,下载安装一个jdk是必须的。
(5)Android SDK不是必要的,但配置方法与手动配置JDK类似,这里不详述。
2.在打开APK时,本想继续上次的修改但误点了重新编译,怎么办?本帖隐藏的内容(1)在使用apk改之理打开一个apk时,apk改之理会先去查看是否存在它的旧工作目录,如果存在会提示是否继续使用旧工作目录(如上图),也就是说这个apk之前修改过,如果本次你想继续上次的修改工作,那么按提示应该点“否”按钮,如果你误点了“是”按钮,也不用担心,因为Apk改之理在重新编译前会把旧工作目录清理到系统回收站,等待本次重新编译完成后,你可以直接从系统回收站还原出旧工作目录使用。
Ubuntu“无法打开锁文件(Couldnotgetlock)”问题解决方法

Ubuntu“⽆法打开锁⽂件(Couldnotgetlock)”问题解决
⽅法
⽤apt-get安装软件时提⽰:
⽆法获得锁/var/lib/dpkg/lock - open(11:资源暂时不可⽤)
⽆法锁定管理⽬录(/var/lib/dpkg/),是否有其他进程正占⽤它?
其实报错已经给了提⽰了,就是有进程正在占⽤apt-get命令,So...
命令跑起来,找出这个进程,kill这个进程!
ps -aux | grep "apt"
sudo kill PID(进程编号)
检查是否还有apt进程:
ps -e | grep apt
如果没有提⽰,则表⽰apt进程已经被杀死
再试试sudo apt-get install (软件)
应该可以安装了...如果还不⾏,⽹上还有其它类似问题解决办法,但不建议使⽤!
总结
以上所述是⼩编给⼤家介绍的Ubuntu“⽆法打开锁⽂件(Could not get lock)”问题解决⽅法,希望对⼤家有所帮助,如果⼤家有任何疑问欢迎给我留⾔,⼩编会及时回复⼤家的!。
Android权限列表permission说明

Android权限列表permission说明需要在AndroidManifest.xml中定义相应的权限(以获取internet访问权限为例),如下:1.< uses-permission android:name =”android.permission.INTERNET” />注意在<application>也可以定义INTERNET权限,如下:1.< application android:permission =”android.permission.INTERNET” >android.permission.ACCESS_CHECKIN_PROPERTIES允许读写访问"properties"表在checkin数据库中,改值可以修改上传( Allows read/write access to the "properties" table in the checkin database, to change values that getuploaded)android.permission.ACCESS_COARSE_LOCATION允许一个程序访问CellID 或WiFi热点来获取粗略的位置(Allows an application to access coarse (e.g., Cell-ID, WiFi) location)android.permission.ACCESS_FINE_LOCATION允许一个程序访问精良位置(如GPS) (Allows an application to access fine (e.g., GPS) location)android.permission.ACCESS_LOCATION_EXTRA_COMMANDS允许应用程序访问额外的位置提供命令(Allows an application to access extra locationprovider commands)android.permission.ACCESS_MOCK_LOCATION允许程序创建模拟位置提供用于测试(Allows an application to create mock location providers for testing) android.permission.ACCESS_NETWORK_STATE允许程序访问有关GSM网络信息(Allows applications to access information about networks)android.permission.ACCESS_SURFACE_FLINGER允许程序使用SurfaceFlinger底层特性(Allows an application to use SurfaceFlinger's low level features)android.permission.ACCESS_WIFI_STATE允许程序访问Wi-Fi网络状态信息(Allows applications to access information about Wi-Fi networks) android.permission.ADD_SYSTEM_SERVICE允许程序发布系统级服务(Allows an application to publish system-level services).android.permission.BATTERY_STATS允许程序更新手机电池统计信息(Allows an application to update the collected battery statistics)android.permission.BLUETOOTH允许程序连接到已配对的蓝牙设备(Allows applications to connect to paired bluetooth devices)android.permission.BLUETOOTH_ADMIN允许程序发现和配对蓝牙设备(Allows applications to discover and pair bluetooth devices)android.permission.BRICK请求能够禁用设备(非常危险)(Required to be able to disable the device (very dangerous!).)android.permission.BROADCAST_PACKAGE_REMOVED允许程序广播一个提示消息在一个应用程序包已经移除后(Allows an application to broadcast a notification that an application package has been removed)android.permission.BROADCAST_STICKY.允许一个程序广播常用intents(Allows an application to broadcast sticky intents)android.permission.CALL_PHONE允许一个程序初始化一个电话拨号不需通过拨号用户界面需要用户确认(Allows an application to initiate a phone call without going through the Dialer user interface for the user to confirm the call being placed.)android.permission.CALL_PRIVILEGED允许一个程序拨打任何号码,包含紧急号码无需通过拨号用户界面需要用户确认(Allows an application to call any phone number, including emergency numbers, without going through the Dialer user interface for the user to confirm the call being placed)android.permission.CAMERA请求访问使用照相设备(Required to be able to access the camera device. )android.permission.CHANGE_COMPONENT_ENABLED_STATE允许一个程序是否改变一个组件或其他的启用或禁用(Allows an application to change whether an application component (other than its own) is enabled or not. )android.permission.CHANGE_CONFIGURATION允许一个程序修改当前设置,如本地化(Allows an application to modify the current configuration, such as locale. )android.permission.CHANGE_NETWORK_STATE允许程序改变网络连接状态(Allows applications to change network connectivity state)android.permission.CHANGE_WIFI_STATE允许程序改变Wi-Fi连接状态(Allows applications to change Wi-Fi connectivity state)android.permission.CLEAR_APP_CACHE允许一个程序清楚缓存从所有安装的程序在设备中(Allows an application to clear the caches of all installed applications on the device. )android.permission.CLEAR_APP_USER_DATA允许一个程序清除用户设置(Allows an application to clear user data)android.permission.CONTROL_LOCATION_UPDATES允许启用禁止位置更新提示从无线模块(Allows enabling/disabling location update notifications from the radio. )android.permission.DELETE_CACHE_FILES允许程序删除缓存文件(Allows an application to delete cache files)android.permission.DELETE_PACKAGES允许一个程序删除包(Allows an application to delete packages)android.permission.DEVICE_POWER允许访问底层电源管理(Allowslow-level access to power management)android.permission.DIAGNOSTIC允许程序RW诊断资源(Allows applications to RW to diagnostic resources. )android.permission.DISABLE_KEYGUARD允许程序禁用键盘锁(Allows applications to disable the keyguard )android.permission.DUMP允许程序返回状态抓取信息从系统服务(Allows an application to retrieve state dump information from system services.) android.permission.EXPAND_STATUS_BAR允许一个程序扩展收缩在状态栏,Android开发网提示应该是一个类似Windows Mobile中的托盘程序(Allows an application to expand or collapse the status bar. )android.permission.FACTORY_TEST作为一个工厂测试程序,运行在root用户(Run as a manufacturer test application, running as the root user. )android.permission.FLASHLIGHT访问闪光灯,Android开发网提示HTC Dream 不包含闪光灯(Allows access to the flashlight )android.permission.FORCE_BACK允许程序强行一个后退操作是否在顶层activities(Allows an application to force a BACK operation on whatever is the top activity. )android.permission.FOTA_UPDATE暂时不了解这是做什么使用的,Android开发网分析可能是一个预留权限.android.permission.GET_ACCOUNTS访问一个帐户列表在Accounts Service 中(Allows access to the list of accounts in the Accounts Service) android.permission.GET_PACKAGE_SIZE允许一个程序获取任何package占用空间容量(Allows an application to find out the space used by any package. ) android.permission.GET_TASKS允许一个程序获取信息有关当前或最近运行的任务,一个缩略的任务状态,是否活动等等(Allows an application to get information about the currently or recently running tasks: a thumbnail representation of the tasks, what activities are running in it, etc.)android.permission.HARDWARE_TEST允许访问硬件(Allows access to hardware peripherals. )android.permission.INJECT_EVENTS允许一个程序截获用户事件如按键、触摸、轨迹球等等到一个时间流,Android开发网提醒算是hook技术吧(Allows an application to inject user events (keys, touch, trackball) into the event stream and deliver them to ANY window.)android.permission.INSTALL_PACKAGES允许一个程序安装packages(Allows an application to install packages. )android.permission.INTERNAL_SYSTEM_WINDOW允许打开窗口使用系统用户界面(Allows an application to open windows that are for use by parts of the system user interface. )android.permission.INTERNET允许程序打开网络套接字(Allows applications to open network sockets)android.permission.MANAGE_APP_TOKENS允许程序管理(创建、催后、z-order默认向z轴推移)程序引用在窗口管理器中(Allows an application to manage (create, destroy, Z-order) application tokens in the window manager. )android.permission.MASTER_CLEAR目前还没有明确的解释,Android开发网分析可能是清除一切数据,类似硬格机android.permission.MODIFY_AUDIO_SETTINGS允许程序修改全局音频设置(Allows an application to modify global audio settings)android.permission.MODIFY_PHONE_STATE允许修改话机状态,如电源,人机接口等(Allows modification of the telephony state - power on, mmi, etc. )android.permission.MOUNT_UNMOUNT_FILESYSTEMS允许挂载和反挂载文件系统可移动存储(Allows mounting and unmounting file systems for removable storage. )android.permission.PERSISTENT_ACTIVITY允许一个程序设置他的activities显示(Allow an application to make its activities persistent. )android.permission.PROCESS_OUTGOING_CALLS允许程序监视、修改有关播出电话(Allows an application to monitor, modify, or abort outgoing calls) android.permission.READ_CALENDAR允许程序读取用户日历数据(Allows an application to read the user's calendar data.)android.permission.READ_CONTACTS允许程序读取用户联系人数据(Allows an application to read the user's contacts data.)android.permission.READ_FRAME_BUFFER允许程序屏幕波或和更多常规的访问帧缓冲数据(Allows an application to take screen shots and more generally get access to the frame buffer data)android.permission.READ_INPUT_STATE允许程序返回当前按键状态(Allows an application to retrieve the current state of keys and switches. ) android.permission.READ_LOGS允许程序读取底层系统日志文件(Allows an application to read the low-level system log files. )android.permission.READ_OWNER_DATA允许程序读取所有者数据(Allows an application to read the owner's data)android.permission.READ_SMS允许程序读取短信息(Allows an application to read SMS messages.)android.permission.READ_SYNC_SETTINGS允许程序读取同步设置(Allows applications to read the sync settings)android.permission.READ_SYNC_STATS允许程序读取同步状态(Allows applications to read the sync stats)android.permission.REBOOT请求能够重新启动设备(Required to be able to reboot the device. )android.permission.RECEIVE_BOOT_COMPLETED允许一个程序接收到ACTION_BOOT_COMPLETED广播在系统完成启动(Allows an application to receive the ACTION_BOOT_COMPLETED that is broadcast after the system finishes booting. )android.permission.RECEIVE_MMS允许一个程序监控将收到MMS彩信,记录或处理(Allows an application to monitor incoming MMS messages, to record or perform processing on them. )android.permission.RECEIVE_SMS允许程序监控一个将收到短信息,记录或处理(Allows an application to monitor incoming SMS messages, to record or perform processing on them.)android.permission.RECEIVE_WAP_PUSH允许程序监控将收到WAP PUSH 信息(Allows an application to monitor incoming WAP push messages. ) android.permission.RECORD_AUDIO允许程序录制音频(Allows an application to record audio)android.permission.REORDER_TASKS允许程序改变Z轴排列任务(Allows an application to change the Z-order of tasks)android.permission.RESTART_PACKAGES允许程序重新启动其他程序(Allows an application to restart other applications)android.permission.SEND_SMS允许程序发送SMS短信(Allows an application to send SMS messages)android.permission.SET_ACTIVITY_WATCHER允许程序监控或控制activities已经启动全局系统中Allows an application to watch and control how activities are started globally in the system.android.permission.SET_ALWAYS_FINISH允许程序控制是否活动间接完成在处于后台时Allows an application to control whether activities are immediately finished when put in the background.android.permission.SET_ANIMATION_SCALE修改全局信息比例(Modify the global animation scaling factor.)android.permission.SET_DEBUG_APP配置一个程序用于调试(Configure an application for debugging.)android.permission.SET_ORIENTATION允许底层访问设置屏幕方向和实际旋转(Allows low-level access to setting the orientation (actually rotation) of the screen.)android.permission.SET_PREFERRED_APPLICATIONS允许一个程序修改列表参数PackageManager.addPackageToPreferred() 和PackageManager.removePackageFromPreferred()方法(Allows an application to modify the list of preferred applications with thePackageManager.addPackageToPreferred() andPackageManager.removePackageFromPreferred() methods.)android.permission.SET_PROCESS_FOREGROUND允许程序当前运行程序强行到前台(Allows an application to force any currently running process to be in the foreground.)android.permission.SET_PROCESS_LIMIT允许设置最大的运行进程数量(Allows an application to set the maximum number of (not needed) application processes that can be running. )android.permission.SET_TIME_ZONE允许程序设置时间区域(Allows applications to set the system time zone)android.permission.SET_WALLPAPER允许程序设置壁纸(Allows applications to set the wallpaper )android.permission.SET_WALLPAPER_HINTS允许程序设置壁纸hits(Allows applications to set the wallpaper hints)android.permission.SIGNAL_PERSISTENT_PROCESSES允许程序请求发送信号到所有显示的进程中(Allow an application to request that a signal be sent to all persistent processes)android.permission.STATUS_BAR允许程序打开、关闭或禁用状态栏及图标Allows an application to open, close, or disable the status bar and its icons.android.permission.SUBSCRIBED_FEEDS_READ允许一个程序访问订阅RSS Feed内容提供(Allows an application to allow access the subscribed feeds ContentProvider. )android.permission.SUBSCRIBED_FEEDS_WRITE系统暂时保留改设置,Android开发网认为未来版本会加入该功能。
Android操作系统与应用开发第5章

第5章 Android数据存储
实际上SharedPreferences是采用xml文件格式将数据存储
到设备中的,文件存放在File Explorer中的
/data/data/<package name>/shares_prefs目录下。如果希望
SharedPreferences使用的xml文件能被其他应用读和写,则可 以指定Context.MODE_WORLD_READABLE和 Context.MODE_WORLD_WRITEABLE权限。
第5章 Android数据存储
button.setOnClickListener(new Button.OnClickListener()
{ @Override public void onClick(View v) { //这部分是自动产生方法桩 try {
//写入数据
第5章 Android数据存储
第5章 Android数据存储
一个实现SharedPreferences存储的实例代码如下:
//获取SharedPreferences对象 SharedPreferences user = getSharedPreferences(“user_info”, MODE_PRIVATE); //存入数据 Editor editor = user.edit(); editor.putString(“NAME”, “hello”);
(当然不是真的SD卡,只是镜像文件)。创建SD卡可以在
Eclipse创建模拟器时随同创建,也可以使用DOS命令进行创
建,操作方法如下: 在DOS窗口中进入Android SDK安装路径的tools目录, 输入以下命令创建一张容量为2 GB的SD卡(文件后缀可以随 便取,建议使用.img): mksdcard 2048M D:\AndroidTool\sdcard.img
ubuntu上在androidstudio中启动emulator闪退的解决方法

ubuntu上在androidstudio中启动emulator闪退的解决⽅法阅读⽬录(Content)平台现象解决⼀、查看模拟器的信息⼆、命令⾏运⾏模拟器平台Ubuntu14.04 64现象在AndrodStudio中点击模拟器的启动按钮后,模拟器界⾯弹出后,⼜⽴刻闪退。
解决⼀、查看模拟器的信息从上⾯可以看到模拟器的存放路径以及名称:路径:/home/pengdonglin/.android/avd/4_WVGA_Nexus_S_API_24.avd名称:4_WVGA_Nexus_S_API_24架构:x86_64⼆、命令⾏运⾏模拟器在androidsdk的路径下⾯运⾏下⾯的命令:./emulator/qemu/linux-x86_64/qemu-system-x86_64 -avd 4_WVGA_Nexus_S_API_24此时出现了错误:emulator: WARNING: encryption is offWARNING: The Mesa software renderer is deprecated. Use Swiftshader (-gpu swiftshader) for software rendering.failed to create drawablegetGLES2ExtensionString: Could not create GLES 2.x Pbuffer!Failed to obtain GLES 2.x extensions string!Could not initialize emulated framebufferwarning: host doesn't support requested feature: CPUID.80000001H:ECX.sse4a [bit 6]warning: host doesn't support requested feature: CPUID.80000001H:ECX.sse4a [bit 6]warning: host doesn't support requested feature: CPUID.80000001H:ECX.sse4a [bit 6]warning: host doesn't support requested feature: CPUID.80000001H:ECX.sse4a [bit 6]emulator: emulator window was out of view and was recenteredemulator: ERROR: Could not initialize OpenglES emulation, use '-gpu off' to disable it.从提⽰中有两种解决办法:1、设置 -gpu swiftshader2、设置 -gpu off在运⾏模拟器的时候,加⼊上⾯任意⼀个,都可以解决问题,但是最终我们并不是从命令⾏运⾏模拟器,所以我们得把这上⾯的配置写到模拟器的启动配置⽂件中。
Gradle:Couldnotdeterminethedependenciesoftask。。。

Gradle:Couldnotdeterminethedependenciesoftask。
我使⽤了⽅案2解决FAQ: AAR打包引⽤丢包问题, jar, aar, dependency 嵌套层级依赖的丢失问: aar包中,如何包含第三⽅依赖库?如果直接作为module 依赖是没有问题的,但是如果打包成aar,确实找不到相关的类。
Android Library项⽬中如果使⽤Android Gradle plugin打aar包,通过maven依赖的库,或者是local依赖的aar都不会包含在⽣成的aar包⾥如果项⽬是发布⼀个SDK,为了⽅便开发者使⽤,我们倾向于⽣成⼀个包含所有依赖库以及.so等⽂件的aar包。
需要解决的问题:1.aar打包丢失lib库maven远程依赖;关于1的解决⽅案可以参考该链接:建⽴本地或者远程的maven库……2.aar打包丢失本地aar依赖关于2的解决⽅案如下:⽅案⼀、所有依赖 Module A 的 Module 都添加: ---给好aar的路径:xxmodule/libs/xx.aar1 2 3 4 5repositories {flatDir {dirs 'xxx/libs'// Module A的libs的⽬录地址 }}把所有的 Module 都添加上 Module A 的 libs ⽬录的相对地址。
⽅案⼆、在Project下的build.gradle中的repositories中添加相应的引⽤如下:12 3 4 5 6 7 8 9 10 11 12allprojects {repositories {jcenter()flatDir {// 由于Library module中引⽤了 gif 库的 aar,在多 module 的情况下, // 其他的module编译会报错,所以需要在所有⼯程的repositories// 下把Library module中的libs⽬录添加到依赖关系中dirs project(':AppLibrary').file('libs')}}}⽅案3、编写脚本,实现aar打包的时候把相应依赖全部打包进aar中为项⽬增加⼀个sub project(如pkg_project)专门⽤于打包,该项⽬中build.gradle内容如下:123456apply plugin: 'java'6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68apply plugin: 'java'version = 1.0buildscript {repositories {mavenCentral()}dependencies {classpath 'com.android.tools.build:gradle:19.1.0'}}repositories {mavenCentral()}dependencies {compile project(':<your_library_project>') //此处填写需要打包的Android Library Project name }task sync_jars() << {//把所有依赖的.jar库都拷贝到build/aar/libs下copy {into buildDir.getPath() +"/aar/libs"from pile.findAll{it.getName().endsWith(".jar")}}}task sync_aars(dependsOn:':<your_library_project>:assembleRelease') << {//把所有依赖的.aar库⾥包含的classes.jar都拷贝到build/aar/libs下,并重命名以不被覆盖def jar_namedef aar_pathdef dest_dir = buildDir.getPath()+"/aar"pile.findAll{it.getName().endsWith(".aar")}.collect{aar_path = it.getPath()jar_name = "libs/"+it.getName().replace(".aar",".jar")copy {from zipTree(aar_path)into dest_dirinclude "**/*"rename 'classes.jar', jar_name}}}task fataar(dependsOn:[sync_aars, sync_jars]) << {task (obfuse_classes_jar, type: proguard.gradle.ProGuardTask) {//把build/aar/libs/*.jar混淆后⽣成build/aar/classes.jarconfiguration "proguard.cfg"injars buildDir.getPath()+"/aar/libs"outjars buildDir.getPath()+"/aar/classes.jar"libraryjars "${System.getProperty('java.home')}/lib/rt.jar"libraryjars "${System.getProperty('java.home')}/Contents/Classes/classes.jar"libraryjars System.getenv("ANDROID_HOME")+"/platforms/android-19/android.jar"}.execute()task (gen_aar, type: Zip) {//把⽣成最终的aar包,注意libs⽬录需要被排除def dest_dir = buildDir.getPath()+"/aar/"baseName = "mysdk-all"extension = "aar"destinationDir = file(buildDir.getPath())from dest_direxclude "libs"}.execute()}最后就可以使⽤gradlew pkg_project:fataar来打包了解决办法:使⽤相对路劲来找到这个aar⽂件。
Android权限列表permission说明
网络上不乏android权限列表,但是很少有将列表和使用方法放在一起的,所以特此总结一下需要在AndroidManifest.xml中定义相应的权限(以获取internet访问权限为例),如下:1.< uses-permission android:name =”android.permission.INTERNET” />注意在<application>也可以定义INTERNET权限,如下:1.< application android:permission =”android.permission.INTERNET” >android.permission.ACCESS_CHECKIN_PROPERTIES允许读写访问"properties"表在checkin数据库中,改值可以修改上传( Allow s read/write access to the "properties" table in the checkin database, to change values that get uploaded)android.permission.ACCESS_COARSE_LOCATION允许一个程序访问CellID或WiFi热点来获取粗略的位置(Allows an applicat ion to access coarse (e.g., Cell-ID, WiFi) location)android.permission.ACCESS_FINE_LOCATION允许一个程序访问精良位置(如GPS) (Allows an application to access fine(e.g., GPS) location)android.permission.ACCESS_LOCATION_EXTRA_COMMANDS允许应用程序访问额外的位置提供命令(Allows an applicatio n to access extra location provider commands)android.permission.ACCESS_MOCK_LOCATION允许程序创建模拟位置提供用于测试(Allows an application to create mock location providers for testing)android.permission.ACCESS_NETWORK_STATE允许程序访问有关GSM网络信息(Allows applications to access informatio n about networks)android.permission.ACCESS_SURFACE_FLINGER允许程序使用SurfaceFlinger底层特性(Allows an application to use Sur faceFlinger's low level features)android.permission.ACCESS_WIFI_STATE允许程序访问Wi-Fi网络状态信息(Allows applications to access information ab out Wi-Fi networks)android.permission.ADD_SYSTEM_SERVICE允许程序发布系统级服务(Allows an application to publish system-level servi ces).android.permission.BATTERY_STATS允许程序更新手机电池统计信息(Allows an application to update the collected batter y statistics)android.permission.BLUETOOTH允许程序连接到已配对的蓝牙设备(Allows applications to connect to paired bluetooth devi ces)android.permission.BLUETOOTH_ADMIN允许程序发现和配对蓝牙设备(Allows applications to discover and pair bluetooth devices)android.permission.BRICK请求能够禁用设备(非常危险)(Required to be able to disable the device (very dangerous!).)android.permission.BROADCAST_PACKAGE_REMOVED允许程序广播一个提示消息在一个应用程序包已经移除后(Allows an a pplication to broadcast a notification that an application package has been removed)android.permission.BROADCAST_STICKY.允许一个程序广播常用intents(Allows an application to broadcast sticky intent s)android.permission.CALL_PHONE允许一个程序初始化一个电话拨号不需通过拨号用户界面需要用户确认(Allows an application t o initiate a phone call without going through the Dialer user interface for the user to confirm the call being placed.)android.permission.CALL_PRIVILEGED允许一个程序拨打任何号码,包含紧急号码无需通过拨号用户界面需要用户确认(Allows an application to call any phone number, including emergency numbers, without going through the Dialer user interface f or the user to confirm the call being placed)android.permission.CAMERA请求访问使用照相设备(Required to be able to access the camera device. )android.permission.CHANGE_COMPONENT_ENABLED_STATE允许一个程序是否改变一个组件或其他的启用或禁用(Allows a n application to change whether an application component (other than its own) is enabled or not. )android.permission.CHANGE_CONFIGURATION允许一个程序修改当前设置,如本地化(Allows an application to modify the current configuration, such as locale. )android.permission.CHANGE_NETWORK_STATE允许程序改变网络连接状态(Allows applications to change network conn ectivity state)android.permission.CHANGE_WIFI_STATE允许程序改变Wi-Fi连接状态(Allows applications to change Wi-Fi connectivity state)android.permission.CLEAR_APP_CACHE允许一个程序清楚缓存从所有安装的程序在设备中(Allows an application to clear the caches of all installed applications on the device. )android.permission.CLEAR_APP_USER_DATA允许一个程序清除用户设置(Allows an application to clear user data)android.permission.CONTROL_LOCATION_UPDATES允许启用禁止位置更新提示从无线模块(Allows enabling/disabling loca tion update notifications from the radio. )android.permission.DELETE_CACHE_FILES允许程序删除缓存文件(Allows an application to delete cache files)android.permission.DELETE_PACKAGES允许一个程序删除包(Allows an application to delete packages)android.permission.DEVICE_POWER允许访问底层电源管理(Allows low-level access to power management)android.permission.DIAGNOSTIC允许程序RW诊断资源(Allows applications to RW to diagnostic resources. )android.permission.DISABLE_KEYGUARD允许程序禁用键盘锁(Allows applications to disable the keyguard )android.permission.DUMP允许程序返回状态抓取信息从系统服务(Allows an application to retrieve state dump information from system services.)android.permission.EXPAND_STATUS_BAR允许一个程序扩展收缩在状态栏,Android开发网提示应该是一个类似Windows Mobi le中的托盘程序(Allows an application to expand or collapse the status bar. )android.permission.FACTORY_TEST作为一个工厂测试程序,运行在root用户(Run as a manufacturer test application, run ning as the root user. )android.permission.FLASHLIGHT访问闪光灯,Android开发网提示HTC Dream不包含闪光灯(Allows access to the flashlight )android.permission.FORCE_BACK允许程序强行一个后退操作是否在顶层activities(Allows an application to force a BACK op eration on whatever is the top activity. )android.permission.FOTA_UPDATE暂时不了解这是做什么使用的,Android开发网分析可能是一个预留权限.android.permission.GET_ACCOUNTS访问一个帐户列表在Accounts Service中(Allows access to the list of accounts in the Accounts Service)android.permission.GET_PACKAGE_SIZE允许一个程序获取任何package占用空间容量(Allows an application to find out th e space used by any package. )android.permission.GET_TASKS允许一个程序获取信息有关当前或最近运行的任务,一个缩略的任务状态,是否活动等等(Allows an application to get information about the currently or recently running tasks: a thumbnail representation of the tasks, what activities are running in it, etc.)android.permission.HARDWARE_TEST允许访问硬件(Allows access to hardware peripherals. )android.permission.INJECT_EVENTS允许一个程序截获用户事件如按键、触摸、轨迹球等等到一个时间流,Android开发网提醒算是hook技术吧(Allows an application to inject user events (keys, touch, trackball) into the event stream and deliver them t o ANY window.)android.permission.INSTALL_PACKAGES允许一个程序安装packages(Allows an application to install packages. )android.permission.INTERNAL_SYSTEM_WINDOW允许打开窗口使用系统用户界面(Allows an application to open windo ws that are for use by parts of the system user interface. )android.permission.INTERNET允许程序打开网络套接字(Allows applications to open network sockets)android.permission.MANAGE_APP_TOKENS允许程序管理(创建、催后、z-order默认向z轴推移)程序引用在窗口管理器中(Allow s an application to manage (create, destroy, Z-order) application tokens in the window manager. )android.permission.MASTER_CLEAR目前还没有明确的解释,Android开发网分析可能是清除一切数据,类似硬格机android.permission.MODIFY_AUDIO_SETTINGS允许程序修改全局音频设置(Allows an application to modify global audio settings)android.permission.MODIFY_PHONE_STATE允许修改话机状态,如电源,人机接口等(Allows modification of the telephony state - power on, mmi, etc. )android.permission.MOUNT_UNMOUNT_FILESYSTEMS允许挂载和反挂载文件系统可移动存储(Allows mounting and unmo unting file systems for removable storage. )android.permission.PERSISTENT_ACTIVITY允许一个程序设置他的activities显示(Allow an application to make its activit ies persistent. )android.permission.PROCESS_OUTGOING_CALLS允许程序监视、修改有关播出电话(Allows an application to monitor, mo dify, or abort outgoing calls)android.permission.READ_CALENDAR允许程序读取用户日历数据(Allows an application to read the user's calendar dat a.)android.permission.READ_CONTACTS允许程序读取用户联系人数据(Allows an application to read the user's contacts dat a.)android.permission.READ_FRAME_BUFFER允许程序屏幕波或和更多常规的访问帧缓冲数据(Allows an application to take sc reen shots and more generally get access to the frame buffer data)android.permission.READ_INPUT_STATE允许程序返回当前按键状态(Allows an application to retrieve the current state of keys and switches. )android.permission.READ_LOGS允许程序读取底层系统日志文件(Allows an application to read the low-level system log fil es. )android.permission.READ_OWNER_DATA允许程序读取所有者数据(Allows an application to read the owner's data) android.permission.READ_SMS允许程序读取短信息(Allows an application to read SMS messages.)android.permission.READ_SYNC_SETTINGS允许程序读取同步设置(Allows applications to read the sync settings) android.permission.READ_SYNC_STATS允许程序读取同步状态(Allows applications to read the sync stats)android.permission.REBOOT请求能够重新启动设备(Required to be able to reboot the device. )android.permission.RECEIVE_BOOT_COMPLETED允许一个程序接收到ACTION_BOOT_COMPLETED广播在系统完成启动(All ows an application to receive the ACTION_BOOT_COMPLETED that is broadcast after the system finishes booting. )android.permission.RECEIVE_MMS允许一个程序监控将收到MMS彩信,记录或处理(Allows an application to monitor incomi ng MMS messages, to record or perform processing on them. )android.permission.RECEIVE_SMS允许程序监控一个将收到短信息,记录或处理(Allows an application to monitor incoming SMS messages, to record or perform processing on them.)android.permission.RECEIVE_WAP_PUSH允许程序监控将收到WAP PUSH信息(Allows an application to monitor incomin g WAP push messages. )android.permission.RECORD_AUDIO允许程序录制音频(Allows an application to record audio)android.permission.REORDER_TASKS允许程序改变Z轴排列任务(Allows an application to change the Z-order of tasks) android.permission.RESTART_PACKAGES允许程序重新启动其他程序(Allows an application to restart other applications) android.permission.SEND_SMS允许程序发送SMS短信(Allows an application to send SMS messages)android.permission.SET_ACTIVITY_WATCHER允许程序监控或控制activities已经启动全局系统中Allows an application to watch and control how activities are started globally in the system.android.permission.SET_ALWAYS_FINISH允许程序控制是否活动间接完成在处于后台时Allows an application to control wh ether activities are immediately finished when put in the background.android.permission.SET_ANIMATION_SCALE修改全局信息比例(Modify the global animation scaling factor.)android.permission.SET_DEBUG_APP配置一个程序用于调试(Configure an application for debugging.)android.permission.SET_ORIENTATION允许底层访问设置屏幕方向和实际旋转(Allows low-level access to setting the orien tation (actually rotation) of the screen.)android.permission.SET_PREFERRED_APPLICATIONS允许一个程序修改列表参数PackageManager.addPackageToPreferre d() 和PackageManager.removePackageFromPreferred()方法(Allows an application to modify the list of preferred applicatio ns with the PackageManager.addPackageToPreferred() and PackageManager.removePackageFromPreferred() methods.)android.permission.SET_PROCESS_FOREGROUND允许程序当前运行程序强行到前台(Allows an application to force any c urrently running process to be in the foreground.)android.permission.SET_PROCESS_LIMIT允许设置最大的运行进程数量(Allows an application to set the maximum numb er of (not needed) application processes that can be running. )android.permission.SET_TIME_ZONE允许程序设置时间区域(Allows applications to set the system time zone)android.permission.SET_WALLPAPER允许程序设置壁纸(Allows applications to set the wallpaper )android.permission.SET_WALLPAPER_HINTS允许程序设置壁纸hits(Allows applications to set the wallpaper hints)android.permission.SIGNAL_PERSISTENT_PROCESSES允许程序请求发送信号到所有显示的进程中(Allow an application to request that a signal be sent to all persistent processes)android.permission.STATUS_BAR允许程序打开、关闭或禁用状态栏及图标Allows an application to open, close, or disable the status bar and its icons.android.permission.SUBSCRIBED_FEEDS_READ允许一个程序访问订阅RSS Feed内容提供(Allows an application to allow access the subscribed feeds ContentProvider. )android.permission.SUBSCRIBED_FEEDS_WRITE系统暂时保留改设置,Android开发网认为未来版本会加入该功能。
黑马程序员安卓教程:Android 中创建数据库
Android 中创建数据库SQLite 简介SQLite 是一款内置到移动设备上的轻量型的数据库,是遵守ACID(原子性、一致性、隔离性、持久性)的关联式数据库管理系统,多用于嵌入式系统中。
SQLite 数据库是无类型的,可以向一个integer 的列中添加一个字符串,但它又支持常见的类型比如: NULL,VARCHAR, TEXT, INTEGER, BLOB, CLOB 等。
Android 系统内置了SQLite,并提供了一系列API 方便对其进行操作。
使用SQLiteOpenHelper创建数据库SQLiteOpenHelper 是Android 提供的一个抽象工具类,负责管理数据库的创建、升级工作。
如果我们想创建数据库,就需要自定义一个类继承SQLiteOpenHelper,然后覆写其中的抽象方法。
一、创建SQLiteOpenHelper类【文件1-1】MySQLiteOpenHelper.java1.package com.itheima.android.sqlite.db;2.3.import android.content.Context;4.import android.database.sqlite.SQLiteDatabase;5.import android.database.sqlite.SQLiteDatabase.CursorFactory;6.import android.database.sqlite.SQLiteOpenHelper;7.import android.util.Log;8./**9.*10.* @author wzy2015-10-2311.* 管理数据库的创建和升级12.*13.*/14.public class MySQLiteOpenHelper extends SQLiteOpenHelper{15.16.private static final String TAG = "MySQLiteOpenHelper";217.//定义数据库文件名18.public static final String TABLE_NAME ="myuser.db";19.20./**21.*22.* @param context23.* @param name 数据库文件的名称24.* @param factory null25.* @param version 数据库文件的版本26.*/27.private MySQLiteOpenHelper(Context context, String name, CursorFactory factory,28.int version){29.super(context, name, factory,version);30.}31./**32.* 对外提供构造函数33.* @param context34.* @param version35.*/36.public MySQLiteOpenHelper(Context context,int version){37.//调用该类中的私有构造函数38.this(context,TABLE_NAME,null, version);39.}40./*41.* 当第一次创建数据的时候回调方法42.*/43.@Override44.public void onCreate(SQLiteDatabase db){45.Log.d(TAG,"onCreate");46.//创建数据库表的语句47.String sql= "create table t_user(uid integer primary key not null,48.c_name varchar(20),c_age integer,c_phone varchar(20))";49.db.execSQL(sql);50.}51./*52.* 当数据库升级是回调该方法53.*/54.@Override55.public void onUpgrade(SQLiteDatabase db,int oldVersion, int newVersion) {56.Log.d(TAG,"onUpgrade: oldVersion"+oldVersion+" newVersion="+newVersion);57.String sql= "alter table t_user add c_money float";58.db.execSQL(sql );59.}60./*61.* 当数据库被打开时回调该方法362.*/63.@Override64.public void onOpen(SQLiteDatabase db) {65.Log.d(TAG,"onOpen");66.}67.68. }注意:上面的代码我们只是定义了一个MySQLiteOpenHelper类继承了SQLiteOpenHelper 类。
[08001]Couldnotcreateconnectiontodatabaseserv。。。
[08001]Couldnotcreateconnectiontodatabaseserv。
使⽤idea连接数据库的时候,报错为[08001] Could not create connection to database server. Attempted reconnect 3 times. Giving up.后来查阅资料发现这都是因为安装mysql的时候时区设置的不正确 mysql默认的是美国的时区,⽽我们中国⼤陆要⽐他们迟8⼩时,采⽤+8:00格式。
使⽤的数据库是MySQL,在你没有指定MySQL驱动版本的情况下它⾃动依赖的驱动是8.0.12很⾼的版本,这是由于数据库和系统时区差异所造成的,在jdbc连接的url后⾯加上serverTimezone=GMT即可解决问题,如果需要使⽤gmt+8时区,需要写成GMT%2B8,否则会被解析为空。
再⼀个解决办法就是使⽤低版本的MySQL jdbc驱动,5.1.28不会存在时区的问题。
在连接字符串后⾯加上?serverTimezone=UTC其中UTC是统⼀标准世界时间。
完整的连接字符串⽰例:jdbc:mysql://localhost:3306/test?serverTimezone=UTC或者还有另⼀种选择:jdbc:mysql://127.0.0.1:3306/test?useUnicode=true&characterEncoding=UTF-8,这个是解决中⽂乱码输⼊问题,当然也可以和上⾯的⼀起结合:jdbc:mysql://127.0.0.1:3306/test?useUnicode=true&characterEncoding=UTF-8&serverTimezone=UTC另⼀种情况改成:jdbc:mysql://localhost:3306/test?serverTimezone=GMT 之后才⾏。
jdbc是mysql-connector-java-8.0.11.jar,设置过时区 set time_zone = ‘+8:00’总结:出现这个问题先看⾃⼰系统设置的时区是UTC还是GMT,再找对应的解决办法。
(三)Apk改之理(Apk IDE)使用常见问题~~~!
1.如何配置Java SDK?鉴于还有很多人不明白如何设置JDK,这里以安装jdk1.6为例,给出一个详细设置步骤:(1)先下载安装JDK1.6:点击这里进入下载JDK6,参考下面的图示下载jdk安装包(点击图片看大图)。
下载jdk1.6本帖隐藏的内容(2)安装jdk1.6,安装时注意它的安装路径,你也可以更改安装路径,假设安装路径为E:\Develop\JDK6。
安装时有二个部份选择安装,一个是JDK,一个是JRE(建议都装),二者的路径可以设置不同,主要是JDK的路径你记得最好,至于JRE随便装哪儿,不过建议都放在一起(如安装到E:\Develop\JDK6\jre,覆盖同名目录没什么问题)。
(PS:安装过程就不详述了,如果连安装都不会,我只能建议你先去学一些电脑的基本知识)(3)如果你照上面的步骤做的,重新打开APK改之理后,它一般就能直接找到JDK的安装路径了,不用再手动配置。
(4)如果没有自动配置好,或者你使用的是免安装绿色版的JDK,你可以手动配置JavaSDK 方法:在APK改之理主界面点菜单“工具-配置SDK”,点击“Java SDK(JDK)”安装路径后面的“浏览”按钮,找到JDK的安装目录(这个示例中就是E:\Develop\JDK6)。
(PS:如果你被提示“无效的安装目录”,若如此,请确保你所选择的目录下存在一个bin文件夹,且这个bin文件夹下包含java.exe、jarsigner.exe等程序。
)【注意】从2.4版开始不再支持jre,必须要jdk,因为jre相对jdk少了很多工具(如jre的bin目录下没有jarsigner.exe等),随着APK改之理的不断升级,有可能用到jdk中的更多工具,所以从2.4开始,下载安装一个jdk是必须的。
(5)Android SDK不是必要的,但配置方法与手动配置JDK类似,这里不详述。
2.在打开APK时,本想继续上次的修改但误点了重新编译,怎么办?本帖隐藏的内容(1)在使用apk改之理打开一个apk时,apk改之理会先去查看是否存在它的旧工作目录,如果存在会提示是否继续使用旧工作目录(如上图),也就是说这个apk之前修改过,如果本次你想继续上次的修改工作,那么按提示应该点“否”按钮,如果你误点了“是”按钮,也不用担心,因为Apk改之理在重新编译前会把旧工作目录清理到系统回收站,等待本次重新编译完成后,你可以直接从系统回收站还原出旧工作目录使用。
- 1、下载文档前请自行甄别文档内容的完整性,平台不提供额外的编辑、内容补充、找答案等附加服务。
- 2、"仅部分预览"的文档,不可在线预览部分如存在完整性等问题,可反馈申请退款(可完整预览的文档不适用该条件!)。
- 3、如文档侵犯您的权益,请联系客服反馈,我们会尽快为您处理(人工客服工作时间:9:00-18:30)。
编写人:誉barbar
在需要打开数据库文件时,可能会遇到Caused by: android.database.sqlite.SQLiteCantOpenDatabaseException: unknown error (code 14): Could not open database这类错误提示,如下图:
一开始,本人以为是文件地址写错了。
但是使用data_file.exists()来检测(data_file的对象是数据库文件),发现文件的路径是没问题的。
那就是问题不出在路径上。
从网上找到的解决方法有两种:
1)在AndroidManifest.xml文件里增加权限<uses-permission
android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
2)把sd卡下的数据库删掉,再重新导入。
然而这些方法依旧无法解决这个问题。
经过几天的研究,终于研究出了解决的方法(没想到,最后还是得靠自己)。
在确认代码没问题的前提下,进入Gradle Scripts下的build.gradle(Module:app)文件进行相关的修改。
如图
要修改的地方有三个,分别是compileSdkVersion 、targetSdkVersion和dependencies 函数。
首先是修改dependencies函数里的compile’com.android support:appcompat-v7:23.0.0’(你的不一定是这个,但是在你工程新建完成后,一定会有这段代码,只是数字可能是其他的)。
将这个代码改成compile’com.android support:appcompat-v7:22.2.1’(这段代码不能直接复制我的,最好手打,因为上标的格式不一定适用于软件)。
如图:
然后将compileSdkVersion 和targetSdkVersion的值相应改成21。
接着将工程文件里apk文件夹里的生成的.apk文件和调试文件删掉(说白了。
就是将apk文件夹里的文件都删掉)。
并且将模拟器中的该应用卸载掉。
然后再重新生成应用文件,这时你就会发现could not open。
这个错误没有了,可以读得到数据库里面的内容了。
如果只改了compileSdkVersion 和targetSdkVersion的值,没有修改dependencies函数,或者只是修改了dependencies函数,没有修改compileSdkVersion 和targetSdkVersion的值,当你删除apk文件夹里的文件和模拟器里面的该软件后,再次编译生成时,就会报错。
如图:
上图属于只修改compileSdkVersion 和targetSdkVersion的值,没有修改dependencies函数。