• linkedu视频
  • 平面设计
  • 电脑入门
  • 操作系统
  • 办公应用
  • 电脑硬件
  • 动画设计
  • 3D设计
  • 网页设计
  • CAD设计
  • 影音处理
  • 数据库
  • 程序设计
  • 认证考试
  • 信息管理
  • 信息安全
菜单
linkedu.com
  • 网页制作
  • 数据库
  • 程序设计
  • 操作系统
  • CMS教程
  • 游戏攻略
  • 脚本语言
  • 平面设计
  • 软件教程
  • 网络安全
  • 电脑知识
  • 服务器
  • 视频教程
  • JavaScript
  • ASP.NET
  • PHP
  • 正则表达式
  • AJAX
  • JSP
  • ASP
  • Flex
  • XML
  • 编程技巧
  • Android
  • swift
  • C#教程
  • vb
  • vb.net
  • C语言
  • Java
  • Delphi
  • 易语言
  • vc/mfc
  • 嵌入式开发
  • 游戏开发
  • ios
  • 编程问答
  • 汇编语言
  • 微信小程序
  • 数据结构
  • OpenGL
  • 架构设计
  • qt
  • 微信公众号
您的位置:首页 > 程序设计 >Android > android开发中遇到的问题汇总【九】

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

作者:网友 字体:[增加 减小] 来源:互联网 时间:2017-05-26

网友通过本文主要向大家介绍了android系统遇到问题,android遇到问题,android开发常见问题,android相机出现问题,android屏幕适配问题等相关知识,希望对您有所帮助,也希望大家支持linkedu.com www.linkedu.com

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 task ‘:app:dexDebug’.> com.android.ide.common.process.ProcessException: org.gradle.process.internal.ExecException: Process ‘command ‘/home/xxx/tools/android/jdk1.7.0_71/bin/java” finished with non-zero exit value 2

检查下是否多次引用同一个jar包
以下情况
1. module下jar包版本不同

同一个module 在libs中包含乐.jar,而在src下又把相应的source页加入了

gradle中是否重复编译,

比如
已经加了compile fileTree(include: [‘*.jar’], dir: ‘libs’)
然而在下面又加一句compile files(‘libs/xxx.jar’)

参考 Error:Execution failed for task ‘:app:dexDebug’. com.android.ide.common.process.ProcessException

246.android handler的警告Handler Class Should be Static or Leaks Occur

在使用Handler更新UI的时候public class SampleActivity extends Activity {

private final Handler mLeakyHandler = new Handler() {
@Override
public void handleMessage(Message msg) {
// TODO
}
}
}会包上述warning 会导致内存泄露
原因在于匿名内部类handler持有activity的引用,当activity finish后 handler还没有处理完,导致activity的view和resource资源不能得到释放,导致内存泄露
针对这个问题google官方给出了正确的做法
通过静态内部类 包含activity的弱引用来处理。
public class SampleActivity extends Activity {

/**
* Instances of static inner classes do not hold an implicit
* reference to their outer class.
*/
private static class MyHandler extends Handler {
private final WeakReference mActivity;

public MyHandler(SampleActivity activity) {
  mActivity = new WeakReference(activity);
}

@Override
public void handleMessage(Message msg) {
  SampleActivity activity = mActivity.get();
  if (activity != null) {
    // ...
  }
}

}

private final MyHandler mHandler = new MyHandler(this);

/**
* Instances of anonymous classes do not hold an implicit
* reference to their outer class when they are “static”.
*/
private static final Runnable sRunnable = new Runnable() {
@Override
public void run() { }
};

@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);

// Post a message and delay its execution for 10 minutes.
mHandler.postDelayed(sRunnable, 60 * 10 * 1000);

// Go back to the previous Activity.
finish();

}
}

参考android handler的警告Handler Class Should be Static or Leaks Occur

247.androidstudio不同tab切换 ctrl+tab

248.androidstudio 如何自动import用到的类或接口?

For Windows/Linux, you can go to File -> Settings -> Editor -> General -> Auto Import -> Java and make the following changes:

change Insert imports on paste value to All

markAdd unambigious imports on the fly option as checked
On a Mac, do the same thing in Android Studio -> Preferences

参考What is the shortcut to Auto import all in Android Studio?

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

/home/cenuser/android/android-ndk-r7b/build/core/build-local.mk:130: *** Android NDK: Aborting    .  Stop.

cd到jni目录。或者 ndk-build -C your_project_path

250 .Why do I want to avoid non-default constructors in fragments? fragment设置参数正确的做法

Make a bundle object and insert your data (in this example your Category object). Be careful, you can't pass this object directly into the bundle, unless it's serializable. I think it's better to build your object in the fragment, and put only an id or something else into bundle. This is the code to create and attach a bundle:

Bundle args = new Bundle();
args.putLong("key", value);
yourFragment.setArguments(args);
After that, in your fragment access data:

Type value = getArguments().getType("key");
That's all.

251. ubuntu下删除.svn的方法

find -type d -name '.svn' -exec rm -rfv {} \;

参考 http://blog.csdn.net/zhaoyu7777777/article/details/9445717

252. Fatal : Could not read from remote repository.

git配置使用,已经把公钥发给发给服务端,在终端命令行也是可以正常的pull push,但是在androidstudio push或者pull的时候确出现上述错误
解决方式
setting –> Version Control –>Git ,In the SSH executable dropdown, choose Native

253. ubuntu获取证书指纹的命令

keytool -list -keystore xxx.keystore
eg:查看debug.keystore
keytool -list -keystore ~/.android/debug.keystore

254. mac 命令行安装软件

通过brew安装,相当于ubuntu中得apt-get
首先安装brew
curl -LsSf http://github.com/mxcl/homebrew/tarball/master | sudo tar xvz -C/usr/local –strip 1
然后就可以使用brew安装软件了
比如 使用brew安装软件 brew install wget

255.代码混淆时 报如下错误 Error:Execution failed for task ‘:app:proguarxxxRelease’.

java.io.IOException: Can’t read [/libs/xxx.jar] (No such file or directory)
http://stackoverflow.com/questions/26028171/android-studio-proguard-java-io-ioexception-bin-classes-no-such-file-or-d

解答 proguard-android.txt文件中不用在指定 -injars, -outjars, or -libraryjars or libs.

The Android Gradle plugin already specifies all input and output for you, so you must not specify -injars, -outjars, or -libraryjars.

Moreover, the file proguard-android.txt in the Android SDK specifies all generic Android settings for you, so you shouldn’t specify them again.

Essentially, your file proguard-rules.txt can be empty, except for any application-specific settings to make sure any reflection continues to work

256.Android中如何设置RadioButton在文字的右边,图标在左边

解决方法 :
第一步:
android:button=”@null”这条语句将原来系统的RadioButton图标给隐藏起来。
第二步:
android:drawableRight=”@android:drawable/btn_radio”这条语句
参考 http://blog.csdn.net/sunnyfans/article/details/7901592

257.java报“非法字符: \65279 ”错误的解决方法

众所周知,在跨程序的工程中,统一编码是至关重要的

分享到:QQ空间新浪微博腾讯微博微信百度贴吧QQ好友复制网址打印

您可能想查找下面的文章:

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

相关文章

  • 2017-05-26android动画详解一 概述
  • 2017-05-26Android ViewPager使用详解
  • 2017-05-26linux 破解版 confluence
  • 2017-05-26android小知识点代码片段
  • 2017-05-26Android动态部署五:如何从插件apk中启动Service
  • 2017-05-26ListView嵌套出现的问题,listview嵌套出现
  • 2017-05-26Touch事件分发
  • 2017-05-26Stack Overflow 排错翻译,stackoverflow
  • 2017-05-26深入浅出《Unix环境高级编程》:Unix基础知识(三)
  • 2017-05-26Android基础部分再学习---activity的生命周期

文章分类

  • JavaScript
  • ASP.NET
  • PHP
  • 正则表达式
  • AJAX
  • JSP
  • ASP
  • Flex
  • XML
  • 编程技巧
  • Android
  • swift
  • C#教程
  • vb
  • vb.net
  • C语言
  • Java
  • Delphi
  • 易语言
  • vc/mfc
  • 嵌入式开发
  • 游戏开发
  • ios
  • 编程问答
  • 汇编语言
  • 微信小程序
  • 数据结构
  • OpenGL
  • 架构设计
  • qt
  • 微信公众号

最近更新的内容

    • Linux简介及常用命令使用5--linux shell编程入门,5--linux编程入门
    • andriod 带看括弧的计算器,andriod括弧计算器
    • Android第四天,神秘封印礼盒第四天
    • 解决Android后台清理APP后,程序自动重启的问题,androidapp
    • 单机搭建Android开发环境(五),单机搭建android开发
    • linux和android调试工具介绍及方法汇总
    • Android实战技巧之四十九:Usb通信之USB Host
    • 插入排序算法详解,排序算法详解
    • Android常见问题及开发经验总结(三)
    • Amazon Alexa登录授权(Android),amazonandroid

关于我们 - 联系我们 - 免责声明 - 网站地图

©2020-2025 All Rights Reserved. linkedu.com 版权所有