博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
Eclipse导入项目时常见问题解决汇总, Android Studio转为Eclipse项目问题汇总
阅读量:2389 次
发布时间:2019-05-10

本文共 2040 字,大约阅读时间需要 6 分钟。

打开eclipse时提示Java was started but returned exit code=13 打开之前先安装jdk8就行。

一、Android Studio转为Eclipse项目问题汇总

1、Theme.AppCompat.Light无法找到问题

使用adt开发新建一个Android app,选择支持的SDK版本如果小于11(Android3.0)就会报如下错误。

error: Error retrieving parent for item: No resource found that matches the given name 'Theme.AppCompat.Light'.

最彻底的解决办法:直接新建一个正常的项目(4.0及以上),把代码和资源全复制到新项目里,肯定能解决。

官网给出的答案是:

https://developer.android.com/tools/support-library/setup.html#add-library

简单来说就是新的eclipse默认模版主题UI需要使用比较高版本api,如果需要支持低版本,需要导入appCompact库来支持,网上一般给出的解法:

File->Import (android-sdk\extras\android\support\v7). Choose "appcompat"

Project-> properties->Android. In the section library "Add" and choose "appCompat"
包括stackoverflow上也有很多人遇到,但很多人通过这个解决,但我就是没办法解决。

2、一些代码类被弃用,或用新的代替了。

1)比如:报错 Error:(303, 27) 错误: 找不到符号 符号: 方法 sin(float) 位置: 类 FloatMath

原因是Android6.0不支持FloatMath.sin()了,主要有两个方法可以解决。

方法一:

用23一下的SDK版本进行编译。将gradle.build文件里(包括project的gradle.build和module的gradle.build)的compileSdkVersion设为23以下。

方法二:

将上面报错的地方,即 用Math类替换FloatMath类,Math.sin();

2)安卓解决6.0以后没有setLatestEventInfo方法,解决办法,直接贴代码

NotificationManager manager = (NotificationManager) this.getSystemService(Context.NOTIFICATION_SERVICE);//新建一个Notification管理器;//API level 11Notification.Builder builder = new Notification.Builder(this);//新建Notification.Builder对象PendingIntent intent = PendingIntent.getActivity(this, 0, new Intent(this, MainActivity.class), 0);//PendingIntent点击通知后所跳转的页面builder.setContentTitle("Bmob Test");builder.setContentText("message");builder.setSmallIcon(R.mipmap.ic_launcher);builder.setContentIntent(intent);//执行intentNotification notification = builder.getNotification();//将builder对象转换为普通的notificationnotification.flags |= Notification.FLAG_AUTO_CANCEL;//点击通知后通知消失manager.notify(1,notification);//运行notification

3.Failed to load

1)比如Failed to load C:\eclipse\eclipse\sdk\build-tools\28.0.3\lib\dx.jar

原因:eclipse自动使用最高版本的SDK,ADT比SDK版本低导致

解决办法一: 从25.0.0里复制一个来替换掉。

解决办法二:

1、用SDK Manager.exe下载低版本的build-tools,如25.0.2

2、在你项目的project.properties文件中加入这个

sdk.buildtools=25.0.2//设置sdk使用的buildtools版本  指定版本编译

 

 

转载地址:http://acaab.baihongyu.com/

你可能感兴趣的文章
如何利用Spring Cloud构建起自我修复型分布式系统
查看>>
Java代码实现设置系统时间
查看>>
java -D参数简化加入多个jar
查看>>
用Erlang开发的文档数据库系统CouchDB
查看>>
Apache Commons工具集简介
查看>>
Apache Cayenne—辣椒你吃了吗?
查看>>
云应用开发工具:Spring Cloud 1.0 正式发布
查看>>
[转]在VC中使用智能指针操作Excel
查看>>
关于Linux命令行环境下无线网卡的配置
查看>>
C++的朋友,你都在用什么连数据库啊
查看>>
Setup Kubernetes on a Raspberry Pi Cluster easily the official way!
查看>>
Installing Kubernetes on Linux with kubeadm
查看>>
k8s-Building Large Clusters
查看>>
[转]stl 通用排序算法解析
查看>>
分布式存储系统GlusterFS初体验
查看>>
GlusterFS常用命令小结
查看>>
GlusterFS分布式文件系统使用简介
查看>>
Use Docker Engine plugins
查看>>
Using Gluster for a Distributed Docker Storage Volume
查看>>
有容云老司机带路, 使用Docker实现丝般顺滑的持续集成
查看>>