我正在构建一个大小约为4MB APK文件的Android应用程序.从几周前开始,在构建签名应用时,生成的APK文件大约为17MB.
在调查了为什么会发生这种情况之后,我发现新的APK档案包含的/lib目录在大小为4MB的旧APK上不存在.有谁知道为什么这个lib目录突然出现在APK档案中,有没有办法删除它?
/libAPK档案中的目录结构是:
/lib
/arm64-v8a
/armeabi
/armeabi-v7a
/mips
/x86
/x86_64
Run Code Online (Sandbox Code Playgroud)
我最近将Android Studio更新为2.0并升级了gradle.这可能是一个问题,是否有一些配置参数可以解决这个问题?
我的gradle文件如下所示:
buildscript {
repositories {
mavenCentral()
maven { url 'https://maven.fabric.io/public' }
}
dependencies {
classpath 'com.android.tools.build:gradle:2.0.0'
classpath 'io.fabric.tools:gradle:1.+'
}
}
apply plugin: 'com.android.application'
apply plugin: 'io.fabric'
repositories {
mavenCentral()
maven { url 'https://maven.fabric.io/public' }
flatDir { dirs 'aars' }
}
android {
// when changing this, YOU MUST change C:\AndroidADT\sdk\build-tools\xx.yy.zz\dx.bat to have -> set java_exe=C:\Windows\System32\java.exe
compileSdkVersion 21
buildToolsVersion "21.1.1"
defaultConfig {
minSdkVersion 11
targetSdkVersion …Run Code Online (Sandbox Code Playgroud) 我正在开发一个允许用户通过 Facebook 和/或 Twitter 共享文章的 Android 应用程序。Facebook 共享使用 ShareDialog 运行良好,它在我的应用程序中打开 Facebook 共享对话框。
我遇到的问题是在 Twitter 上发帖。如果用户安装了 Twitter 应用程序,分享就可以完美运行。当设备上没有安装 Twitter 应用程序时,Twitter 共享页面会在默认浏览器中打开,用户在发推后永远不会返回到我的应用程序,这是一种糟糕的用户体验。
我发布推文的代码是:
Intent intent = new TweetComposer.Builder(context).text("Tweet text.").createIntent();
startActivityForResult(intent, SHARE_ACTION_TWITTER);
Run Code Online (Sandbox Code Playgroud)
我也试过这个:
TweetComposer.Builder builder = new TweetComposer.Builder(this).text("Tweet text.");
builder.show();
Run Code Online (Sandbox Code Playgroud)
当用户没有安装 Twitter 应用程序时,有没有办法在我的应用程序中获取对话框(类似于 Facebook 共享行为)?
此外,对于统计,我想知道用户是否已成功发布推文。如果用户没有安装 Twitter 应用程序,如何使用 Fabric Twitter API 实现这一点?我应该使用不同的 API 吗?
我看过很多关于如何使用 Surfaceview 将视频从 android 相机实时流式传输到 rtmp 服务器的示例。一个在这里:https : //github.com/begeekmyfriend/yasea
但是是否可以使用纹理视图将视频从相机流式传输到 rtmp?如果是,我们怎么办?
Textureview mTextureView;
// inside oncreate
mTextureView = (TextureView) findViewById(R.id.texture_view);
mTextureView.setSurfaceTextureListener(AircraftControlActivity.this);
// Outside OnCreate
@Override
public void onSurfaceTextureAvailable(final SurfaceTexture surface, final int width, final int height) {
}
@Override
public void onSurfaceTextureSizeChanged(SurfaceTexture surface, int width, int height) {
}
@Override
public boolean onSurfaceTextureDestroyed(SurfaceTexture surface) {
}
@Override
public void onSurfaceTextureUpdated(final SurfaceTexture surface) {
}
Run Code Online (Sandbox Code Playgroud)
接下来做什么?
实际上我正在尝试制作一个库存应用程序。
因此,在扫描一些条形码后,我将它们添加到 an 中ArrayList,然后在 a 中recyclerView,我的recyclerView有一个过滤方法和 a ,searchView因此用户应该能够搜索投掷条形码,并且必须能够在滑动时删除搜索到的项目。
当我打开我的recyclerView项目时dialogAlert,如果我删除项目,一切正常,但是当我搜索一个项目并将其删除,然后我关闭该项目时,searchView该项目仍然保留在recyclerView.
我将在此处提供我的适配器代码,以及我在活动中构建和删除项目的代码。
这是活动中的代码:
@SuppressLint("SetTextI18n")
@TargetApi(Build.VERSION_CODES.KITKAT)
public void alertDeleteSingleItem(final int position){
final AlertDialog.Builder mBuilder = new AlertDialog.Builder(InventarioActivity.this);
@SuppressLint("InflateParams") View mView = getLayoutInflater().inflate(R.layout.alert_confirm_delete, null);
final Button yes = mView.findViewById(R.id.btnSI);
final Button no = mView.findViewById(R.id.btnNO);
final TextView text = mView.findViewById(R.id.textView);
text.setText("ELIMINARE " + itemAdapter.getList().get(position).getCodiceArticolo() + " ?");
mBuilder.setView(mView);
final AlertDialog dialog = mBuilder.create();
Objects.requireNonNull(dialog.getWindow()).setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_STATE_VISIBLE);
dialog.show();
yes.setOnClickListener(new View.OnClickListener() {
@Override …Run Code Online (Sandbox Code Playgroud) 我的列表视图是这样的(每行4个TextViews):

当我点击B1和D3时,它们变成了灰色(这很好!).
但是当我滚动时,我发现另外两个TextView也变成了灰色,尽管我没有点击它们.
我的自定义适配器是:
public class MyAdapter extends BaseAdapter {
private Context cont;
private int count;
public MyAdapter (Context c, int numberOfRow) {
this.cont = c;
this.count = numberOfRow;
}
@Override
public int getCount() {
return count;
}
@Override
public Object getItem(int arg0) {
return null;
}
@Override
public long getItemId(int position) {
return 0;
}
@SuppressLint("NewApi")
@Override
public View getView(int position, View convertView, ViewGroup parent) {
View v = convertView;
if (v == null) {
LayoutInflater inflater = (LayoutInflater) …Run Code Online (Sandbox Code Playgroud)