您的位置:首页 > 移动开发 > Android开发

做android的一个sdk遇到的问题

2013-07-17 16:32 309 查看


给别人做个广告联盟,要给开发者提供一个sdk,然后集成到他们的应用中,在开发的过程中遇到了很多问题,再此记录一下:
1.代码创建webview很简单:

private WebView webView;
webView = new WebView(this);
webView.setLayoutParams(new LayoutParams(LayoutParams.MATCH_PARENT,LayoutParams.MATCH_PARENT)) 2.把一些图片资源放入到assets,然后可以一起打入jar包,访问的方法为:
private static Bitmap getImageFromAssetsFile(String fileName)
{
Bitmap image = null;
AssetManager am = activity.getResources().getAssets();
try
{
InputStream is = am.open(fileName);
image = BitmapFactory.decodeStream(is);
is.close();
}
catch (IOException e)
{
e.printStackTrace();
}

return image;

}3.定义一个ImageButton
ImageButton ib2 = new ImageButton(activity);
ib2.setId(3);
ib2.setImageBitmap(getImageFromAssetsFile("haoqi_btn_cancle.jpg"));
ib2.setBackgroundColor(Color.TRANSPARENT); //设置透明

4.混淆,用的sdk\tools\proguard\bin\proguardgui.bat 对jar进行的混淆
主要做的配置就是:[shrinking]步中设置了一下keep:

android.app.Activity

android.app.Service

public method
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: