android导入android,在android中,编译的项目使用到第三方jar的导入方法 终极版!...

1,首先之是增加Android.mk文件

LOCAL_PATH:= $(call my-dir)

include $(CLEAR_VARS)

LOCAL_MODULE_TAGS := optional

LOCAL_SRC_FILES := $(call all-java-files-under, src)

src/com/android/music/IMediaPlaybackService.aidl

LOCAL_PACKAGE_NAME := Music

LOCAL_PROGUARD_FLAG_FILES := proguard.flags

include $(BUILD_PACKAGE)

编译会找不到引用的包中对应的类和方法。

2,然后在声明包,在.mk中加入

LOCAL_PATH:= $(call my-dir)

include $(CLEAR_VARS)

LOCAL_MODULE_TAGS := optional

#声明包名

LOCAL_STATIC_JAVA_LIBRARIES := android-support-v4 pinyin4j-2.5.0

LOCAL_SRC_FILES := $(call all-java-files-under, src)

src/com/android/music/aidl/IMediaService.aidl

LOCAL_PACKAGE_NAME := Music

include $(BUILD_PACKAGE)

include $(CLEAR_VARS)

#指明包的位置

LOCAL_PREBUILT_STATIC_JAVA_LIBRARIES := pinyin4j-2.5.0:lib/pinyin4j-2.5.0.jar

include $(BUILD_MULTI_PREBUILT)

3,这时编译有可能还会报错。(...can't find superclass or interface...)

Warning: demo.Pinyin4jAppletDemo$1: can't find superclass or interface java.awt.event.WindowAdapter

Warning: demo.Pinyin4jAppletDemo$3: can't find superclass or interface java.awt.event.ActionListener

Warning: demo.Pinyin4jAppletDemo$2: can't find superclass or interface java.awt.event.ActionListener

Warning: demo.Pinyin4jAppletDemo: can't find superclass or interface javax.swing.JApplet

Warning: demo.Pinyin4jAppletDemo$1: can't find referenced class java.awt.event.WindowAdapter

Warning: demo.Pinyin4jAppletDemo$1: can't find referenced method 'void stop()' in class demo.Pinyin4jAppletDemo

Warning: demo.Pinyin4jAppletDemo$1: can't find referenced method 'void destroy()' in class demo.Pinyin4jAppletDemo

Warning: demo.Pinyin4jAppletDemo$1: can't find referenced class java.awt.event.WindowAdapter

Warning: demo.Pinyin4jAppletDemo$1: can't find referenced class java.awt.event.WindowEvent

Warning: demo.Pinyin4jAppletDemo$3: can't find referenced class javax.swing.JComboBox

Warning: demo.Pinyin4jAppletDemo$3: can't find referenced class javax.swing.JComboBox

这好像的混淆编译造成的错误,然后在应用的根文件夹下建立proguard.cfg这个文件,在里面输入:

-dontwarn demo.**

-keep class demo.** { *;}

查看编译报的错误,有几个包出错。就在里面加几个这种声明。这里是有demo.下的java报错,仅仅加这个即可。然后在Android.mk中加入此文件的标识。

LOCAL_PROGUARD_FLAG_FILES := proguard.cfg

然后在编译。应该就能够通过。

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值