这是我在Android Studio中的第一个项目,我的应用程序代码没有混淆.我在build.gradle文件中使用此配置:

我正在使用Build> Generate Signed APK ...检查Run Proguard.而且,当我使用Apk_OneClick.v4.2进行测试时,我的代码完全易于理解:

请帮我.:(
我尝试使用proguard生成一个apk,但是在尝试构建时我遇到了这个错误:
Warning: com.google.android.gms.internal.zzhu: can't find referenced class android.security.NetworkSecurityPolicy
Warning: there were 3 unresolved references to classes or interfaces.
You may need to add missing library jars or update their versions. If your code works fine without the missing classes, you can suppress the warnings with '-dontwarn' options.
(http://proguard.sourceforge.net/manual/troubleshooting.html#unresolvedclass)
:app:proguardRelease FAILED
Error:Execution failed for task ':app:proguardRelease'.
java.io.IOException: Please correct the above warnings first.
Run Code Online (Sandbox Code Playgroud)
最近,我升级了我的Android SDK工具.在此之前,这个项目没有提出proguard的问题.我找到了这篇帖子(https://plus.google.com/+PaulBurke/posts/T3vmAnRP3q6),其中Oliver Renner写道:
"所以基本上下一个谷歌库可能无法升级到最新版本.它似乎还需要compileSdk 23才能在不修改的情况下使用ProGuard(警告:com.google.android.gms.internal.zzhu:can找不到引用类android.security.NetworkSecurityPolicy)"*
我更新了我的项目以使用SDK 23进行编译,但问题没有解决.
贝娄,我包含了build.gradle文件的一些部分:
compileSdkVersion 23
buildToolsVersion "23.0.0"
defaultConfig {
applicationId "com.sample.sample" …Run Code Online (Sandbox Code Playgroud) 我正在尝试创建一个自定义对话框,以在屏幕底部显示值列表.
如何删除对话框边距?
我要这个...

我有这个...

对话框代码:
Dialog d = new Dialog(this);
d.requestWindowFeature(Window.FEATURE_NO_TITLE);
d.setContentView(R.layout.dialog_options);
Window window = d.getWindow();
WindowManager.LayoutParams wlp = window.getAttributes();
wlp.width = WindowManager.LayoutParams.MATCH_PARENT;
wlp.gravity = Gravity.BOTTOM;
window.setAttributes(wlp);
d.show();
Run Code Online (Sandbox Code Playgroud)
解决了!更好的方案:
<style name="BottomOptionsDialogTheme" parent="Theme.AppCompat.Light.Dialog">
<item name="android:windowBackground">@null</item>
<item name="android:windowNoTitle">true</item>
<item name="android:windowIsFloating">false</item>
<item name="android:layout_margin">0dp</item>
<item name="android:padding">0dp</item>
<item name="android:layout_gravity">bottom</item>
<item name="colorPrimary">@color/orange_dark</item>
<item name="colorPrimaryDark">@color/orange_dark</item>
<item name="colorAccent">@color/gray_light</item>
</style>
Run Code Online (Sandbox Code Playgroud)
并使用新的Dialog(context,R.theme.BottomOptionsDialogTheme);
我正在尝试创建一个有两种风格的单一项目:free和pro(版本).
我的应用已经在PlayStore中使用不同的包(例如:com.example.appfree和com.example.app)
这是我的build.gradle:
defaultConfig {
applicationId "com.example.appfree"
}
productFlavors{
lite {
applicationIdSuffix 'lite'
}
pro {
}
}
Run Code Online (Sandbox Code Playgroud)
这是我的清单文件:
<?xml version="1.0" encoding="utf-8"?>
<manifest
xmlns:android="http://schemas.android.com/apk/res/android"
package="com.example.app">
<application
android:allowBackup="true"
android:icon="@mipmap/ic_launcher"
android:label="@string/app_name"
android:supportsRtl="true"
android:theme="@style/AppTheme">
<activity
android:name=".SplashScreenActivity"
android:label="@string/app_name">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity android:name=".MainActivity"/>
</application>
</manifest>
Run Code Online (Sandbox Code Playgroud)
我尝试免费上传构建apk和专业版.专业味道还可以,但谷歌不接受免费的味道,因为包装不正确.我怎么解决这个问题?
======解决:====== applicationIdSuffix仅适用于buildTypes.
我想实现一个按钮来启用/禁用沉浸式全屏模式.我正在使用这些方法,但showSystemUI只能快速显示并再次隐藏...
如何完全退出沉浸式模式?
我的方法:
// This snippet hides the system bars.
@SuppressLint("NewApi")
private void hideSystemUI() {
try{
// Set the IMMERSIVE flag.
// Set the content to appear under the system bars so that the content
// doesn't resize when the system bars hide and show.
mDecorView.setSystemUiVisibility(
View.SYSTEM_UI_FLAG_LAYOUT_STABLE
| View.SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION
| View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN
| View.SYSTEM_UI_FLAG_HIDE_NAVIGATION // hide nav bar
| View.SYSTEM_UI_FLAG_FULLSCREEN // hide status bar
| View.SYSTEM_UI_FLAG_IMMERSIVE);
}catch(Exception e){
getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN,
WindowManager.LayoutParams.FLAG_FULLSCREEN);
}
}
// This snippet shows the system bars. It does …Run Code Online (Sandbox Code Playgroud) 我也在使用带有搜索栏的操作栏,我需要像Back按钮一样使用ActionBar ico:

但我也在使用导航抽屉......如何解除/隐藏/禁用导航抽屉菜单以使用后退按钮?
我的ActionBar代码:
@Override
public boolean onCreateOptionsMenu(Menu menu){
MenuInflater inflater = getMenuInflater();
inflater.inflate(R.menu.main, menu);
this.getSupportActionBar().setDisplayShowCustomEnabled(true);
this.getSupportActionBar().setDisplayShowTitleEnabled(false);
this.getSupportActionBar().setDisplayHomeAsUpEnabled(true);
this.getSupportActionBar().setHomeButtonEnabled(true);
LayoutInflater inflator = (LayoutInflater) this.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
View v;
if(!searchView){
v = inflator.inflate(R.layout.action_textview, null);
((TextView) v.findViewById(R.id.titleText)).setText(actionTitle);
menu.getItem(0).setVisible(true);
menu.getItem(2).setVisible(true);
mainMenu = menu;
}else{
v = inflator.inflate(R.layout.action_searchview, null);
actionSearch = (EditText) v.findViewById(R.id.searchText);
actionSearch.setOnEditorActionListener(new OnEditorActionListener() {
@Override
public boolean onEditorAction(TextView view, int actionId, KeyEvent event) {
int result = actionId & EditorInfo.IME_MASK_ACTION;
switch(result) {
case EditorInfo.IME_ACTION_DONE:
case EditorInfo.IME_ACTION_NEXT:
case EditorInfo.IME_ACTION_GO:
case 0:
((InputMethodManager)getSystemService(INPUT_METHOD_SERVICE)).hideSoftInputFromWindow(actionSearch.getWindowToken(), 0);
String temp …Run Code Online (Sandbox Code Playgroud) android ×6
proguard ×2
back ×1
dialog ×1
drawer ×1
fullscreen ×1
layout ×1
manifest ×1
merge ×1
navigation ×1