android开发中遇到的问题汇总【七】

212.Android WebView常见问题及解决方案汇总

http://blog.csdn.net/t12x3456/article/details/13769731

213.Android check network connectivity on some tablets crash

java.lang.NullPointerException

at com.xxx.Util.getNetworkState(Util.java:246)

214.What is the equivalent of Eclipse “Custom debug Keystore” in Android studio?

http://stackoverflow.com/questions/17189076/what-is-the-equivalent-of-eclipse-custom-debug-keystore-in-android-studio

215.Android Studio在调试时,修改变量的值 在“Variables”窗口中,选择需要修改的变量,然后右键,选“Set Value…”。快捷键F2

216.打开百度定位导致MyApplication中的初始化重新加载一遍。如果此时有自动登录等,会导致重新登录 而目前的凭证失效

217.android webview和js交互json对象 。通过字符串传递。然后通过jsonobject把字符串生成json对象从中获取数据。

218. Android Studio开发jni ndk

主要有以下三块

1. Javah生成JNI头文件

需要进入到/src/mian 这个目录下 。如果不进入这个目录等会运行javah的时候会提示: 错误: 找不到 ‘com.lcj.ndk_demo_2.HelloNDK’ 的类文件

javah -d jni -classpath ….\build\intermediates\classes\debug com.lcj.ndk_demo_2.HelloNDK

jni 是生成的头文件需要存放的文件夹(一般取名jni才对)

….\build\intermediates\classes\debug 是class所在目录(Build—>Make Project生成的class文件都在这里,这是一个相对路径)

com.lcj.ndk_demo_2.HelloNDK 是class文件的文件名(根据之前的java文件生成的)

参考 http://wenku.baidu.com/view/105474098e9951e79b8927a3.html

2.根据上不生成的.h文件 写.c和makefile

3.ndk-build【这个androidstudio1.2已经集成,可以直接编译ndk,所以多一个选择】

易出现的问题 When running the ndk-build command I get the following error:

Android NDK: Could not find application project directory !
Android NDK: Please define the NDK_PROJECT_PATH variable to point to it

解决方案

NDK_PROJECT_PATH is an environment variable so you don‘t have to include in the Android.mkfile. Is nkd-build launched in the project directory?

For more info read the docs in docs/HOWTO.html in the NDK folder where I read

Starting with NDK r4, you can simply place the file under $PROJECT/jni/ and launch the ‘ndk-build‘ script from your project tree.

If you want to use ‘ndk-build‘ but place the file to a different location, use a GNU Make variable override as:

ndk-build NDK_APPLICATION_MK=/path/to/your/Application.mk

219.Android下使用lamemp3库将PCM录音数据压缩为MP3格式

        文章最下面有demo 很不错 通过javah修改下,可以直接用
   来源:    http://ikinglai.blog.51cto.com/6220785/1228730

220.Android Studio 不自动弹起代码提示功能解决办法 do not auto popup code completion

升级后不自动弹起代码提醒功能了,而且变量也不标注颜色,简直是气死我了,Google了各种关键词,都没办法

后来看到有个Power Save Mode,昨天看到笔记本发热厉害就给勾上了,是不是这个原因呢?

取消之后一切正常,看来是省电模式下禁用了这些功能,通过反射来实现代码的autoComplete是会增加CPU运算量。

File–>Power Save Mode .勾掉省电模式

参考:http://blog.csdn.net/ameryzhu/article/details/14105275

221. 百度地图相关 在Genymotion上启动项目时,程序抛出异常

  1. 问题描述:

    1、在Genymotion上启动项目时,程序抛出异常,报错日志为:11-10 09:18:44.577: E/com.btten.base.CrashReportHandler(1298): Caused by: java.lang.UnsatisfiedLinkError: Cannot load library: load_library[1093]: Library ‘/system/lib/libhoudini.so’ not found

  2. 问题分析:

    1、鉴于Genymotion是只支持x86架构的,所以从.so文件入手找问题,项目中导入了jpush的.so配置文件,jpush官网上的解释通常都是http://docs.jpush.cn/pages/viewpage.action?pageId=7864765,新建x86、mips 、armeabi-v7a几个目录,然后把libjpush.so也复制一份过去。尝试之后发现不起作用。

  3. 解决办法:

    1、网上找了很久发现如下办法,下载一个ARM Translation Installer的压缩包,安装到Genymotion上,重启下,重新运行程序,ok,问题顺利解决。简要摘抄步骤如下:

    Download the following ZIPs:

    ARM Translation Installer v1.1 Hosted by FILETRIP(Mirrors) - If you have issues flashing ARM Trnaslation, Try re-downloading from a mirror

    Download the correct GApps for your Android version:

    If you have issues flashing GApps, Try re-downloading from a mirror

    Google Apps for Android 4.4(Mirror)(Download from CM11 Links)(4.4 GApps might be buggy)

    Google Apps for Android 4.3(Mirrors)

    Google Apps for Android 4.2

    Google Apps for Android 4.1

    Next Open your Genymotion VM and go to the Homescreen

    Now Drag&Drop the Genymotion-ARM-Translation.zip onto the Genymotion VM window.

    It should say “File transfer in progress”, once it asks you to flash it click ‘OK’

    Now Reboot your VM using ADB or an app like ROM Toolbox. If nescessary you can simply close the VM window, but I don’t recommend it.

    详情转载地址:http://forum.xda-developers.com/showthread.php?t=2528952

222. 百度地图相关。E/baidumapsdk﹕ Authentication Error errorcode: -1 uid: -1 appid -1 msg: AndroidManifest.xml的application中没有meta-data标签

223. 百度地图相关 百度地图去掉缩放按钮

MapView放在ScrollView中,滚动时出现黑条

http://bbs.lbsyun.baidu.com/forum.php?mod=viewthread&tid=1093

应该GLSurfaceView放在ScrollView内部的问题.1.3.5用View直接绘制没有问题.能否在下版中提供一个底层基于View绘制的MapView

版主,我在想,当滚动用截取当前地图的bitmap.(调用getCurrentMap())然后盖在GLSurface上.但getCurrentMap()操作是异步的,用android自带的View.getDrawingCache()也未能成功获取.上述不成功后,由于需求限制可以对地图不操作,尝试了下能不能再MapView完成地图加载后getCurrentMap()把截图放在ImageView中盖在MapView上,但未能找到相应的监听方法.见贴:http://bbs.lbsyun.baidu.com/viewthread.php?tid=1104&extra=page%3D1.现在改用1.3.5在做.QQ:396920165能否交流下

scrollview内嵌mapview后的滑动问题

百度地图mapview放在scrollview中滑动黑屏

后面我试下了直接用截图功能。mapview设置隐藏,然后方法没被执行。是不是在mapview 不显示的情况下。截图功能不可用?

开始移动前截图覆盖

静态。不可拖动但是可要能点击

建议不要在scroll中使用mapview 因为本身map是用opengl绘制的,这个东西在scroll中存在性能问题,所以导致的体验效果不佳,请考虑改变实现方式。

百度map1.3.5

http://developer.baidu.com/map/reference/index.php?title=Class:android%E6%A0%B8%E5%BF%83%E7%B1%BB/MapView

静态【不可放大缩小】的mapview。点击无效

http://www.cnblogs.com/trinea/archive/2012/11/14/2770433.html

224.Android自定义DataTimePicker(日期选择器) http://blog.csdn.net/wwj_748/article/details/38778631

225.Content-Type: application/x-www-form-urlencoded;

可以通过mitmproty分析

https://www.imququ.com/post/four-ways-to-post-data-in-http.html

四种常见的 POST 提交数据方式

application/x-www-form-urlencoded

multipart/form-data

text/xml

application/json

text/xml

226.androidstudio 升级后无法使用git svn等代码管理工具。

vcs –>Enable Version Control Integration 选择git/subversion 即可

227.androidstudio 升级后发现 编写代码自动提醒功能没了。

原因在于打开了File—>Power Saved Mode,关闭即可。

228.dshow 音频采集

229.kill -SIGKILL PID

强行中止(经常使用杀掉)一个进程标识号为324的进程:

  #kill -9 324

  (2)解除Linux系统的死锁

   在Linux中有时会发生这样一种情况:一个程序崩溃,并且处于死锁的状态。此时一般不用重新启动计算机,只需要中止(或者说是关闭)这个有问题的程序 即可。当kill处于X-Window界面时,主要的程序(除了崩溃的程序之外)一般都已经正常启动了。此时打开一个终端,在那里中止有问题的程序。比 如,如果Mozilla浏览器程序出现了锁死的情况,可以使用kill命令来中止所有包含有Mozolla浏览器的程序。首先用ps命令查找该程序的 PID,然后使用kill命令停止这个程序:

  #kill -SIGKILL XXX

  其中,XXX是包含有Mozolla浏览器的程序的进程标识号。

  (3)使用命令回收内存

  我们知道内存对于系统是非常重要的,回收内存可以提高系统资源。kill命令可以及时地中止一些”越轨”的程序或很长时间没有相应的程序。例如,使用top命令发现一个无用(Zombie)的进程,此时可以使用下面命令:

  #kill -9 XXX

  其中,XXX是无用的进程标识号。

  然后使用下面命令:

  #free

  此时会发现可用内存容量增加了。

  (4)killall命令

  Linux下还提供了一个killall命令,可以直接使用进程的名字而不是进程标识号,例如:

  # killall -HUP inetd

230.android导入eclipse项目后,出现如下问题

1.Error:The project is using an unsupported version of the Android Gradle plug-in (0.12.2). The recommended version is 1.2.3.

classpath ‘com.android.tools.build:gradle:1.2.3’

在build.gradle 根据提示把

dependencies {

classpath ‘com.android.tools.build:gradle:0.12.+’

}

修改为

dependencies {

classpath ‘com.android.tools.build:gradle:1.2.3’

}

2.上面修改后会出现如下错误:

Error:Unable to load class ‘org.codehaus.groovy.runtime.typehandling.ShortTypeHandling’.

Possible causes for this unexpected error include:You are using JDK version ‘java version “1.7.0_71”’. Some versions of JDK 1.7 (e.g. 1.7.0_10) may cause class loading errors in Gradle.

Please update to a newer version (e.g. 1.7.0_67).

明明用的就是jdk1.7.0_71[比1.7.0_67还新] 却提示不对,问题起始不在jdk这而是 gradle-wrapper.properties

distributionUrl=http://services.gradle.org/distributions/gradle-1.12-all.zip 估计用的是jdk1.7.0.10

把 distributionUrl=http://services.gradle.org/distributions/gradle-1.12-all.zip

修改为 distributionUrl=https://services.gradle.org/distributions/gradle-2.2.1-all.zip

ok 经过上面两步,从studio导入eclipse项目的正常使用。

231.android 注释模板

Settings–>Editor–>File and Code Templates–>Includes

232.shape中子节点的常用属性

  1. <gradient> 渐变

android:startColor 起始颜色

android:endColor 结束颜色

android:angle 渐变角度,0从上到下,90表示从左到右,数值为45的整数倍默认为0;

android:type 渐变的样式 liner线性渐变 radial环形渐变 sweep

例如:

<shape xmlns:android="http://schemas.android.com/apk/res/android"
    type="rectangle">
    <gradient
        android:angle="270"
        android:endColor="#9f36a0"
        android:startColor="#65216a" />
</shape>

2.<corners > 圆角

android:radius 圆角的半径 值越大角越圆

android:topRightRadius 右上圆角半径

android:bottomLeftRadius 右下圆角角半径

android:topLeftRadius 左上圆角半径

android:bottomRightRadius 左下圆角半径

如果你把4个角设成为90的话,那么改图片是一个圆!

3.<solid > 填充

android:color 填充的颜色

4.<stroke > 描边

android:width 描边的宽度

android:color 描边的颜色

android:dashWidth 表示’-‘横线的宽度

android:dashGap 表示’-‘横线之间的距离

参考 http://blog.csdn.net/cs_li1126/article/details/11781577

#

233. GestureOverlayView

234.Animation lInAnim = AnimationUtils.loadAnimation(mActivity, R.anim.push_left_in);

时间: 2024-08-29 18:24:11

android开发中遇到的问题汇总【七】的相关文章

android开发中遇到的问题汇总【二】

36.代码规范 http://liuzhichao.com/p/1781.html#more-1781 // Disallow Parent Intercept, just in case ViewParent parent = getParent(); if (parent != null) { parent.requestDisallowInterceptTouchEvent(true); } 38.在纯属布局中,将除最底部以外的的view都设置weight为1就可以了. 39.editvi

android开发中遇到的问题汇总【九】

244.http请求的url含有中字符时.须要Uri编码.Uri.encoder() 245.使用androidstudio时,不知道什么原因svn不见了 Android Studio missing Subversion plugin Please make sure that the "SubversionIntegration" plugin is enabled in Preferences > Plugins 246.Error:Execution failed for

android开发中遇到的问题汇总【八】

一. 工具使用 245.使用androidstudio时,不知道什么原因svn不见了 Android Studio missing Subversion plugin Please make sure that the "SubversionIntegration" plugin is enabled in Preferences > Plugins 248.androidstudio 如何自动import用到的类或接口? For Windows/Linux, you can g

android开发中遇到的问题汇总【三】

在EditText中插入表情图片 (CharacterStyle&SpannableString) http://gundumw100.iteye.com/blog/904107 EditText通常用于显示文字,但有时候也需要在文字中夹杂一些图片,比如QQ中就可以使用表情图片,又比如需要的文字高亮显示等等,如何在android中也做到这样呢? 记得android中有个android.text包,这里提供了对文本的强大的处理功能. 添加图片主要用SpannableString和ImageSpan

android开发中遇到的问题汇总【四】

92. Looks like there is no way to avoid modifications made by the import plugin. All the settings it has is three checkboxes related to dependency management. I tried to uncheck all of them but still it does change my project structure. I managed to

android开发中遇到的问题汇总(五)

127.ANDROID仿IOS时间_ANDROID仿IOS弹出提示框 http://dwtedx.com/itshare_297.html 128. Android TextView drawableLeft 在代码中实现 方法1 Drawable drawable= getResources().getDrawable(R.drawable.drawable); /// 这一步必须要做,否则不会显示. drawable.setBounds(0, 0, drawable.getMinimumWi

android开发中遇到的问题汇总【六】

190. Genymotion Crash after a few minutes E/eglCodecCommon(2163): writeFully: failed: Broken pipe http://stackoverflow.com/questions/23855115/genymotion-crash-after-a-few-minutes It's not really caused by your application, so don't worry. It often ha

Android开发中使用七牛云存储进行图片上传下载

Android开发中的图片存储本来就是比较耗时耗地的事情,而使用第三方的七牛云,便可以很好的解决这些后顾之忧,最近我也是在学习七牛的SDK,将使用过程在这记录下来,方便以后使用. 先说一下七牛云的存储原理,上面这幅图片是官方给出的原理图,表述当然比较清晰了.可以看出,要进行图片上传的话可以分为五大步: 1. 客户端用户登录到APP的账号系统里面: 2. 客户端上传文件之前,需要向业务服务器申请七牛的上传凭证,这个凭证由业务服务器使用七牛提供的服务端SDK生成: 3. 客户端使用七牛提供的客户端S

android开发中经常遇到的问题汇总

大家都在为项目开发成功而喜悦,但可不知成功的路上是会经常出错的,下面是我碰到的一些错误集合! [错误信息] [2011-01-19 16:39:10 - ApiDemos] WARNING: Application does not specify an API level requirement![2011-01-19 16:39:10 - ApiDemos] Device API version is 8 (Android 2.2) 原因: 不影响正常运行.在AndroidManifest.