小编kum*_*ail的帖子

了java.lang.RuntimeException:com.android.builder.dexing.DexArchiveMergerException:无法在Android Studio中3.0合并DEX

这是我的gradle文件:

    apply plugin: 'com.android.application'

android {
    compileSdkVersion 26
    buildToolsVersion '27.0.0'
    useLibrary 'org.apache.http.legacy'
    defaultConfig {
        multiDexEnabled true
        applicationId 'com.example.test'
        minSdkVersion 16
        targetSdkVersion 26
        versionCode 1
        versionName "1.0"
        testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
    }

    compileOptions {
        sourceCompatibility JavaVersion.VERSION_1_8
        targetCompatibility JavaVersion.VERSION_1_8
    }

    productFlavors {
    }
    dexOptions {
        incremental true
    }
}

dependencies {
    compile 'com.google.android.gms:play-services:10.0.1'
    compile 'com.android.support:appcompat-v7:26.+'
    compile 'com.android.support:multidex:1.0.1'
    compile 'com.android.support.constraint:constraint-layout:1.0.0-alpha7'
    compile 'commons-io:commons-io:1.3.2'
    compile 'com.mcxiaoke.volley:library:1.0.19'
    compile 'com.facebook.stetho:stetho:1.5.0'
    compile 'com.github.PhilJay:MPAndroidChart:v3.0.2'
}
Run Code Online (Sandbox Code Playgroud)

编译项目时得到的完整错误是:

错误:任务':app:transformDexArchiveWithExternalLibsDexMergerForDebug'的执行失败.

java.lang.RuntimeException:com.android.builder.dexing.DexArchiveMergerException:无法合并dex

完整的错误如下:

    Executing tasks: [:app:assembleDebug]

AGPBI: {"kind":"warning","text":"The `android.dexOptions.incremental` property is deprecated and it has …
Run Code Online (Sandbox Code Playgroud)

java android gradle

64
推荐指数
2
解决办法
14万
查看次数

应用程序关闭时广播接收器不工作

所以我制作了两个不同的应用程序,一个发送广播,另一个接收广播并显示祝酒词。但是,当我关闭接收器应用程序时,即使我在清单文件中定义了接收器,第二个应用程序也不再接收广播。

app1 的 MainActivity 中的广播发送者。

public class MainActivity extends AppCompatActivity {

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_main);

    Button b = (Button)findViewById(R.id.button2);
    b.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View v) {
            Intent i = new Intent();
            i.setAction("com.example.ali.rrr");
            i.addFlags(Intent.FLAG_INCLUDE_STOPPED_PACKAGES);
            sendBroadcast(i);
            Log.e("Broadcast","sent");
        }
    });
}
Run Code Online (Sandbox Code Playgroud)

应用2广播接收器:

public class MyReceiver extends BroadcastReceiver {

@Override
public void onReceive(Context context, Intent intent) {
    // TODO: This method is called when the BroadcastReceiver is receiving
    // an Intent broadcast.
    Toast.makeText(context, "Broadcast has been recieved!", Toast.LENGTH_SHORT).show(); …
Run Code Online (Sandbox Code Playgroud)

java android broadcastreceiver android-intent

6
推荐指数
3
解决办法
1万
查看次数

firebase.firestore.FieldValue.arrayUnion 不是函数

我正在尝试更新我的 Firestore 中的数组,我按照 Google 提供的文档(https://firebase.google.com/docs/firestore/manage-data/add-data)但它不起作用,我还检查以确保我拥有最新版本的 firebase npm 模块。

这是我的代码:

> db
                    .collection('Data')
                    .doc('One')
                    .collection('Doc')
                    .doc(this.$route.params.id.toLowerCase())
                    .update({
                        myArr: firebase.firestore.FieldValue.arrayUnion(
                           'test'
                        ),
                    })
                    .then(() => console.log('Successfully written'))
                    .catch(err => console.log(err));
Run Code Online (Sandbox Code Playgroud)

javascript firebase google-cloud-firestore

6
推荐指数
1
解决办法
7866
查看次数

深入观察不在对象 Vue 上工作

我在一个数组上设置了一个观察器,并在它上面启用了深度观察,但是当数组更改时处理程序函数不会触发,应用程序是在 data 中返回的对象中定义的。这是代码:

  watch: {
    applications: {
      handler: function(val, oldVal) {
        console.log('app changed');
      },
      deep: true,
    },
    page(newPage) {
      console.log('Newpage', newPage);
    },
  },
Run Code Online (Sandbox Code Playgroud)

javascript oop vue.js

4
推荐指数
1
解决办法
8200
查看次数