我正在尝试使用Ant和ProGuard构建Android版本.我在project.properties中取消注释了以下行,尽管所述文件中的注释指出你不应该修改它;):
proguard.config=${sdk.dir}/tools/proguard/proguard-android.txt:proguard-project.txt
Run Code Online (Sandbox Code Playgroud)
混淆时,我得到以下注释:
[proguard] Note: the configuration refers to the unknown class 'com.google.vending.licensing.ILicensingService'
[proguard] Note: the configuration refers to the unknown class 'com.android.vending.licensing.ILicensingService'
Run Code Online (Sandbox Code Playgroud)
我明白为什么会这样.这些行可以在默认的ProGuard配置文件中找到($ {sdk.dir} /tools/proguard/proguard-android.txt):
-keep public class com.google.vending.licensing.ILicensingService
-keep public class com.android.vending.licensing.ILicensingService
Run Code Online (Sandbox Code Playgroud)
我没有使用Google许可服务,因此这些课程确实未知.我找到了一个解决方案,通过更新proguard-project.txt来摆脱这些笔记:
-dontnote **ILicensingService
Run Code Online (Sandbox Code Playgroud)
我的问题:这是处理这个问题的正确方法吗?在我看来,无论如何都不应该保留这些类,因为对于android项目来说,lib不是必需的.我能想到实现这一目标的唯一方法是将默认配置文件复制到我的项目中,删除-keep行并完全忽略SDK中的默认配置文件.这似乎也不是正确的方法.或者我错过了什么?
在a中使用PendingIntent时AppWidgetProvider,我使用以下代码:
views.setOnClickPendingIntent( viewId,
PendingIntent.getBroadcast( context, 0, intent,
PendingIntent.FLAG_UPDATE_CURRENT ) );
Run Code Online (Sandbox Code Playgroud)
所以目前没有对getBroadcast方法返回的PendingIntent的引用.在特定情况下,我现在想要取消PendingIntent.有没有办法从视图中获取PendingIntent?或者是之后通过保持对它的引用来调用PendingIntent的cancel方法的唯一方法?
如何使用textview两侧的按钮创建布局?这是我到目前为止所得到的:
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:orientation="horizontal" >
<Button
android:id="@+id/left_button"
android:layout_width="72dip"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:text="left" />
<TextView
android:id="@+id/center_textview"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerHorizontal="true"
android:layout_marginTop="5dip"
android:padding="10dip"
android:text="textview" />
<Button
android:id="@+id/right_button"
android:layout_width="72dip"
android:layout_height="wrap_content"
android:layout_alignParentRight="true"
android:text="right" />
</RelativeLayout>
Run Code Online (Sandbox Code Playgroud)
这里的问题是textview是居中的.我希望textview填充剩下的完整空间.我尝试将其android:layout_width设置为fill_parent并删除android:layout_centerHorizontal,但它似乎与按钮重叠.