问:
Android- Error:Execution failed for task ':app:transformClassesWithDexForRelease'
The Problem is that i am able to run my app when i change to debug mode but it fails when i switch to release mode.

Exception:

```<code>**FAILURE: Build failed with an exception.**
> Execution failed for task ':app:transformClassesWithDexForRelease'.
> com.android.build.api.transform.TransformException: com.android.ide.common.process.ProcessException: java.util.concurrent.ExecutionException: com.android.ide.common.process.ProcessException: org.gradle.process.internal.ExecException: Process 'command '/Library/Java/JavaVirtualMachines/jdk1.8.0_65.jdk/Contents/Home/bin/java'' finished with non-zero exit value 1
</code>```

When i ran the gradle build command with stacktrace then this is what i get

```<code>./gradlew app:transformClassesWithDexForRelease --stacktrace

> com.android.build.api.transform.TransformException: com.android.ide.common.process.ProcessException: java.util.concurrent.ExecutionException: com.android.ide.common.process.ProcessException: org.gradle.process.internal.ExecException: Process 'command '/Library/Java/JavaVirtualMachines/jdk1.8.0_73.jdk/Contents/Home/bin/java'' finished with non-zero exit value 1

*Exception is:*

>org.gradle.api.tasks.TaskExecutionException: Execution failed for task ':app:transformClassesWithDexForRelease'.
            at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.executeActions(ExecuteActionsTaskExecuter.java:69)
            at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.execute(ExecuteActionsTaskExecuter.java:46)
            at org.gradle.api.internal.tasks.execution.PostExecutionAnalysisTaskExecuter.execute(PostExecutionAnalysisTaskExecuter.java:35)
            at org.gradle.api.internal.tasks.execution.SkipUpToDateTaskExecuter.execute(SkipUpToDateTaskExecuter.java:64)
            at org.gradle.api.internal.tasks.execution.ValidatingTaskExecuter.execute(ValidatingTaskExecuter.java:58)
            at org.gradle.api.internal.tasks.execution.SkipEmptySourceFilesTaskExecuter.execute(SkipEmptySourceFilesTaskExecuter.java:52)
            at org.gradle.api.internal.tasks.execution.SkipTaskWithNoActionsExecuter.execute(SkipTaskWithNoActionsExecuter.java:52)
            at org.gradle.api.internal.tasks.execution.SkipOnlyIfTaskExecuter.execute(SkipOnlyIfTaskExecuter.java:53)
            at org.gradle.api.internal.tasks.execution.ExecuteAtMostOnceTaskExecuter.execute(ExecuteAtMostOnceTaskExecuter.java:43)
            at org.gradle.execution.taskgraph.DefaultTaskGraphExecuter$EventFiringTaskWorker.execute(DefaultTaskGraphExecuter.java:203)
            at org.gradle.execution.taskgraph.DefaultTaskGraphExecuter$EventFiringTaskWorker.execute(DefaultTaskGraphExecuter.java:185)
            at org.gradle.execution.taskgraph.AbstractTaskPlanExecutor$TaskExecutorWorker.processTask(AbstractTaskPlanExecutor.java:66)
            at org.gradle.execution.taskgraph.AbstractTaskPlanExecutor$TaskExecutorWorker.run(AbstractTaskPlanExecutor.java:50)
            at org.gradle.execution.taskgraph.DefaultTaskPlanExecutor.process(DefaultTaskPlanExecutor.java:25)
            at org.gradle.execution.taskgraph.DefaultTaskGraphExecuter.execute(DefaultTaskGraphExecuter.java:110)
            at org.gradle.execution.SelectedTaskExecutionAction.execute(SelectedTaskExecutionAction.java:37)
            at org.gradle.execution.DefaultBuildExecuter.execute(DefaultBuildExecuter.java:37)
            at org.gradle.execution.DefaultBuildExecuter.access$000(DefaultBuildExecuter.java:23)
            at org.gradle.execution.DefaultBuildExecuter$1.proceed(DefaultBuildExecuter.java:43)
            at org.gradle.execution.DryRunBuildExecutionAction.execute(DryRunBuildExecutionAction.java:32)
            at org.gradle.execution.DefaultBuildExecuter.execute(DefaultBuildExecuter.java:37)
            at org.gradle.execution.DefaultBuildExecuter.execute(DefaultBuildExecuter.java:30)
            at org.gradle.initialization.DefaultGradleLauncher$4.run(DefaultGradleLauncher.java:154)
            at org.gradle.internal.Factories$1.create(Factories.java:22)
            at org.gradle.internal.progress.DefaultBuildOperationExecutor.run(DefaultBuildOperationExecutor.java:90)
            at org.gradle.internal.progress.DefaultBuildOperationExecutor.run(DefaultBuildOperationExecutor.java:52)
            at org.gradle.initialization.DefaultGradleLauncher.doBuildStages(DefaultGradleLauncher.java:151)
            at org.gradle.initialization.DefaultGradleLauncher.access$200(DefaultGradleLauncher.java:32)
            at org.gradle.initialization.DefaultGradleLauncher$1.create(DefaultGradleLauncher.java:99)
            at org.gradle.initialization.DefaultGradleLauncher$1.create(DefaultGradleLauncher.java:93)
            at org.gradle.internal.progress.DefaultBuildOperationExecutor.run(DefaultBuildOperationExecutor.java:90)
            at org.gradle.internal.progress.DefaultBuildOperationExecutor.run(DefaultBuildOperationExecutor.java:62)
            at org.gradle.initialization.DefaultGradleLauncher.doBuild(DefaultGradleLauncher.java:93)
            at org.gradle.initialization.DefaultGradleLauncher.run(DefaultGradleLauncher.java:82)
            at org.gradle.launcher.exec.InProcessBuildActionExecuter$DefaultBuildController.run(InProcessBuildActionExecuter.java:94)
            at org.gradle.tooling.internal.provider.ExecuteBuildActionRunner.run(ExecuteBuildActionRunner.java:28)
            at org.gradle.launcher.exec.ChainingBuildActionRunner.run(ChainingBuildActionRunner.java:35)
            at org.gradle.launcher.exec.InProcessBuildActionExecuter.execute(InProcessBuildActionExecuter.java:43)
            at org.gradle.launcher.exec.InProcessBuildActionExecuter.execute(InProcessBuildActionExecuter.java:28)
            at org.gradle.launcher.exec.ContinuousBuildActionExecuter.execute(ContinuousBuildActionExecuter.java:78)
            at org.gradle.launcher.exec.ContinuousBuildActionExecuter.execute(ContinuousBuildActionExecuter.java:48)
            at org.gradle.launcher.daemon.server.exec.ExecuteBuild.doBuild(ExecuteBuild.java:52)
            at org.gradle.launcher.daemon.server.exec.BuildCommandOnly.execute(BuildCommandOnly.java:36)
            at org.gradle.launcher.daemon.server.api.DaemonCommandExecution.proceed(DaemonCommandExecution.java:120)
            at org.gradle.launcher.daemon.server.exec.WatchForDisconnection.execute(WatchForDisconnection.java:37)
            at org.gradle.launcher.daemon.server.api.DaemonCommandExecution.proceed(DaemonCommandExecution.java:120)
            at org.gradle.launcher.daemon.server.exec.ResetDeprecationLogger.execute(ResetDeprecationLogger.java:26)
            at org.gradle.launcher.daemon.server.api.DaemonCommandExecution.proceed(DaemonCommandExecution.java:120)
            at org.gradle.launcher.daemon.server.exec.RequestStopIfSingleUsedDaemon.execute(RequestStopIfSingleUsedDaemon.java:34)
            at org.gradle.launcher.daemon.server.api.DaemonCommandExecution.proceed(DaemonCommandExecution.java:120)
            at org.gradle.launcher.daemon.server.exec.ForwardClientInput$2.call(ForwardClientInput.java:74)
            at org.gradle.launcher.daemon.server.exec.ForwardClientInput$2.call(ForwardClientInput.java:72)
            at org.gradle.util.Swapper.swap(Swapper.java:38)
            at org.gradle.launcher.daemon.server.exec.ForwardClientInput.execute(ForwardClientInput.java:72)
            at org.gradle.launcher.daemon.server.api.DaemonCommandExecution.proceed(DaemonCommandExecution.java:120)
            at org.gradle.launcher.daemon.server.health.DaemonHealthTracker.execute(DaemonHealthTracker.java:47)
            at org.gradle.launcher.daemon.server.api.DaemonCommandExecution.proceed(DaemonCommandExecution.java:120)
            at org.gradle.launcher.daemon.server.exec.LogToClient.doBuild(LogToClient.java:66)
            at org.gradle.launcher.daemon.server.exec.BuildCommandOnly.execute(BuildCommandOnly.java:36)
            at org.gradle.launcher.daemon.server.api.DaemonCommandExecution.proceed(DaemonCommandExecution.java:120)
            at org.gradle.launcher.daemon.server.exec.EstablishBuildEnvironment.doBuild(EstablishBuildEnvironment.java:72)
            at org.gradle.launcher.daemon.server.exec.BuildCommandOnly.execute(BuildCommandOnly.java:36)
            at org.gradle.launcher.daemon.server.api.DaemonCommandExecution.proceed(DaemonCommandExecution.java:120)
            at org.gradle.launcher.daemon.server.health.HintGCAfterBuild.execute(HintGCAfterBuild.java:41)
            at org.gradle.launcher.daemon.server.api.DaemonCommandExecution.proceed(DaemonCommandExecution.java:120)
            at org.gradle.launcher.daemon.server.exec.StartBuildOrRespondWithBusy$1.run(StartBuildOrRespondWithBusy.java:50)
            at org.gradle.launcher.daemon.server.DaemonStateCoordinator$1.run(DaemonStateCoordinator.java:246)
            at org.gradle.internal.concurrent.ExecutorPolicy$CatchAndRecordFailures.onExecute(ExecutorPolicy.java:54)
            at org.gradle.internal.concurrent.StoppableExecutorImpl$1.run(StoppableExecutorImpl.java:40)
    Caused by: java.lang.RuntimeException: com.android.build.api.transform.TransformException: com.android.ide.common.process.ProcessException: java.util.concurrent.ExecutionException: com.android.ide.common.process.ProcessException: org.gradle.process.internal.ExecException: Process 'command '/Library/Java/JavaVirtualMachines/jdk1.8.0_73.jdk/Contents/Home/bin/java'' finished with non-zero exit value 1
            at com.android.builder.profile.Recorder$Block.handleException(Recorder.java:54)
            at com.android.builder.profile.ThreadRecorder$1.record(ThreadRecorder.java:57)
            at com.android.builder.profile.ThreadRecorder$1.record(ThreadRecorder.java:47)
            at com.android.build.gradle.internal.pipeline.TransformTask.transform(TransformTask.java:173)
            at org.gradle.internal.reflect.JavaMethod.invoke(JavaMethod.java:75)
            at org.gradle.api.internal.project.taskfactory.AnnotationProcessingTaskFactory$IncrementalTaskAction.doExecute(AnnotationProcessingTaskFactory.java:244)
            at org.gradle.api.internal.project.taskfactory.AnnotationProcessingTaskFactory$StandardTaskAction.execute(AnnotationProcessingTaskFactory.java:220)
            at org.gradle.api.internal.project.taskfactory.AnnotationProcessingTaskFactory$IncrementalTaskAction.execute(AnnotationProcessingTaskFactory.java:231)
            at org.gradle.api.internal.project.taskfactory.AnnotationProcessingTaskFactory$StandardTaskAction.execute(AnnotationProcessingTaskFactory.java:209)
            at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.executeAction(ExecuteActionsTaskExecuter.java:80)
            at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.executeActions(ExecuteActionsTaskExecuter.java:61)
            ... 68 more
    Caused by: com.android.build.api.transform.TransformException: com.android.ide.common.process.ProcessException: java.util.concurrent.ExecutionException: com.android.ide.common.process.ProcessException: org.gradle.process.internal.ExecException: Process 'command '/Library/Java/JavaVirtualMachines/jdk1.8.0_73.jdk/Contents/Home/bin/java'' finished with non-zero exit value 1
            at com.android.build.gradle.internal.transforms.DexTransform.transform(DexTransform.java:422)
            at com.android.build.gradle.internal.pipeline.TransformTask$3.call(TransformTask.java:178)
            at com.android.build.gradle.internal.pipeline.TransformTask$3.call(TransformTask.java:174)
            at com.android.builder.profile.ThreadRecorder$1.record(ThreadRecorder.java:55)
            ... 77 more
    Caused by: com.android.ide.common.process.ProcessException: java.util.concurrent.ExecutionException: com.android.ide.common.process.ProcessException: org.gradle.process.internal.ExecException: Process 'command '/Library/Java/JavaVirtualMachines/jdk1.8.0_73.jdk/Contents/Home/bin/java'' finished with non-zero exit value 1
            at com.android.builder.core.AndroidBuilder.runDexer(AndroidBuilder.java:1472)
            at com.android.builder.core.AndroidBuilder.convertByteCode(AndroidBuilder.java:1389)
            at com.android.build.gradle.internal.transforms.DexTransform.transform(DexTransform.java:250)
            ... 80 more
    Caused by: java.util.concurrent.ExecutionException: com.android.ide.common.process.ProcessException: org.gradle.process.internal.ExecException: Process 'command '/Library/Java/JavaVirtualMachines/jdk1.8.0_73.jdk/Contents/Home/bin/java'' finished with non-zero exit value 1
            at com.android.builder.core.AndroidBuilder.runDexer(AndroidBuilder.java:1456)
            ... 82 more
    Caused by: com.android.ide.common.process.ProcessException: org.gradle.process.internal.ExecException: Process 'command '/Library/Java/JavaVirtualMachines/jdk1.8.0_73.jdk/Contents/Home/bin/java'' finished with non-zero exit value 1
            at com.android.build.gradle.internal.process.GradleProcessResult.assertNormalExitValue(GradleProcessResult.java:43)
            at com.android.builder.core.AndroidBuilder$2.call(AndroidBuilder.java:1464)
            at com.android.builder.core.AndroidBuilder$2.call(AndroidBuilder.java:1456)
    Caused by: org.gradle.process.internal.ExecException: Process 'command '/Library/Java/JavaVirtualMachines/jdk1.8.0_73.jdk/Contents/Home/bin/java'' finished with non-zero exit value 1
            at org.gradle.process.internal.DefaultExecHandle$ExecResultImpl.assertNormalExitValue(DefaultExecHandle.java:367)
            at com.android.build.gradle.internal.process.GradleProcessResult.assertNormalExitValue(GradleProcessResult.java:41)
            ... 2 more
</code>```

I am using

Android Studio 2.0 Beta 6

Java version: Java(TM) SE Runtime Environment (build 1.8.0_73-b02)

Gradle Version: com.android.tools.build:gradle:2.0.0-beta6

And i have Multidex enabled

My build.gradle file

```<code>apply plugin: 'com.android.application'
apply plugin: 'com.getkeepsafe.dexcount'

android {

    def VERSION_CODE = 52
    def VERSION_NAME = "1.0"
    compileSdkVersion 23
    buildToolsVersion '23.0.2'

    defaultConfig {
        applicationId "com.example.app"
        manifestPlaceholders = [appName: "Personal App"]
        minSdkVersion 14
        targetSdkVersion 23
        renderscriptTargetApi 19
        renderscriptSupportModeEnabled true
        versionCode VERSION_CODE
        versionName VERSION_NAME

        // Enabling multidex support.
        multiDexEnabled true
    }

    compileOptions {
        sourceCompatibility JavaVersion.VERSION_1_7
        targetCompatibility JavaVersion.VERSION_1_7
        encoding = 'UTF-8'
    }

    signingConfigs {
        livekeystore {
            storeFile file('../key.jks')
            keyAlias 'livekeystore'
            keyPassword '123asd'
            storePassword '123asd'
        }
    }

    buildTypes {
        release {
            minifyEnabled true
            shrinkResources true
            zipAlignEnabled true
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.txt'
            signingConfig signingConfigs.burgerking

            manifestPlaceholders = [googleMapsKey: "@string/release_google_map_key", appNameSuffix: ""]
        }

        debug {
            applicationIdSuffix '.dev'
            debuggable true
            minifyEnabled false
            shrinkResources false
            zipAlignEnabled false

            manifestPlaceholders = [googleMapsKey: "@string/debug_google_map_key", appNameSuffix: ' (Dev-' + VERSION_CODE + ')']

        }
    }

    dexOptions {
        incremental true
        javaMaxHeapSize "4g" // 2g should be also OK
    }

    useLibrary 'org.apache.http.legacy'

}

repositories {
    maven { url 'https://mint.splunk.com/gradle/' }
    maven { url "http://dl.bintray.com/populov/maven" }
    mavenCentral()
}

buildscript {
    repositories {
        mavenCentral()
    }

    dependencies {
        classpath 'com.getkeepsafe.dexcount:dexcount-gradle-plugin:0.4.2'
        classpath 'com.newrelic.agent.android:agent-gradle-plugin:4.244.0'
    }
}

dependencies {
    compile 'com.google.code.gson:gson:2.4'
    compile 'com.android.support:appcompat-v7:23.2.0'
    compile 'com.android.support:recyclerview-v7:23.2.0'
    compile 'com.android.support:cardview-v7:23.2.0'
    compile 'com.android.support:design:23.2.0'
    compile 'com.android.support:multidex:1.0.1'
    compile 'com.google.android.gms:play-services-base:8.4.0'
    compile 'com.google.android.gms:play-services-location:8.4.0'
    compile 'com.google.android.gms:play-services-analytics:8.4.0'
    compile 'com.google.android.gms:play-services-maps:8.4.0'
    compile 'com.google.android.gms:play-services-ads:8.4.0'
    compile 'com.googlecode.libphonenumber:libphonenumber:7.0.5'
    compile 'com.facebook.android:facebook-android-sdk:4.1.1'
    compile 'de.greenrobot:eventbus:2.4.0'
    compile 'com.viewpagerindicator:library:2.4.1@aar'
    compile 'com.nineoldandroids:library:2.4.0'
    compile 'com.squareup.picasso:picasso:2.5.2'
    compile 'com.squareup:pollexor:2.0.2'
    compile 'com.makeramen:roundedimageview:2.1.0'
    compile 'com.mcxiaoke.volley:library:1.0.16@aar'
    compile files('libs/now-auth-api.jar')
    compile 'com.jakewharton:butterknife:5.1.2'
    compile 'com.github.ksoichiro:android-observablescrollview:1.2.0'
    compile 'io.card:android-sdk:5.3.0'
    compile 'com.appboy:android-sdk-ui:1.10.3'
    testCompile 'junit:junit:4.11'
    testCompile('org.mockito:mockito-core:1.9.5') {
        exclude group: 'org.hamcrest'
    }
    testCompile('org.powermock:powermock-module-junit4:1.5') {
        exclude group: 'org.hamcrest'
    }
    testCompile('org.powermock:powermock-api-mockito:1.6.2') {
        exclude group: 'org.hamcrest'
    }

    compile 'me.grantland:autofittextview:0.2.1'

}
</code>```

It seems i am able to get my release build working if i remove minifyEnabled true from it. Why is that, is there another way to solve it

答:
None of these answers worked for me. I am using Android studio 3.4.1.

I was able to build the project but Android studio showing this error when I was going to deploy it to mobile device. It turns out it is "instant runs" fault.

Follow this answer:
https://stackoverflow.com/a/42695197/3197467

Body:
The Problem is that i am able to run my app when i change to debug mode but it fails when i switch to release mode.

Exception:

**FAILURE: Build failed with an exception.**
> Execution failed for task ':app:transformClassesWithDexForRelease'.
> com.android.build.api.transform.TransformException: com.android.ide.common.process.ProcessException: java.util.concurrent.ExecutionException: com.android.ide.common.process.ProcessException: org.gradle.process.internal.ExecException: Process 'command '/Library/Java/JavaVirtualMachines/jdk1.8.0_65.jdk/Contents/Home/bin/java'' finished with non-zero exit value 1

When i ran the gradle build command with stacktrace then this is what i get

./gradlew app:transformClassesWithDexForRelease --stacktrace

> com.android.build.api.transform.TransformException: com.android.ide.common.process.ProcessException: java.util.concurrent.ExecutionException: com.android.ide.common.process.ProcessException: org.gradle.process.internal.ExecException: Process 'command '/Library/Java/JavaVirtualMachines/jdk1.8.0_73.jdk/Contents/Home/bin/java'' finished with non-zero exit value 1

*Exception is:*

>org.gradle.api.tasks.TaskExecutionException: Execution failed for task ':app:transformClassesWithDexForRelease'.
            at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.executeActions(ExecuteActionsTaskExecuter.java:69)
            at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.execute(ExecuteActionsTaskExecuter.java:46)
            at org.gradle.api.internal.tasks.execution.PostExecutionAnalysisTaskExecuter.execute(PostExecutionAnalysisTaskExecuter.java:35)
            at org.gradle.api.internal.tasks.execution.SkipUpToDateTaskExecuter.execute(SkipUpToDateTaskExecuter.java:64)
            at org.gradle.api.internal.tasks.execution.ValidatingTaskExecuter.execute(ValidatingTaskExecuter.java:58)
            at org.gradle.api.internal.tasks.execution.SkipEmptySourceFilesTaskExecuter.execute(SkipEmptySourceFilesTaskExecuter.java:52)
            at org.gradle.api.internal.tasks.execution.SkipTaskWithNoActionsExecuter.execute(SkipTaskWithNoActionsExecuter.java:52)
            at org.gradle.api.internal.tasks.execution.SkipOnlyIfTaskExecuter.execute(SkipOnlyIfTaskExecuter.java:53)
            at org.gradle.api.internal.tasks.execution.ExecuteAtMostOnceTaskExecuter.execute(ExecuteAtMostOnceTaskExecuter.java:43)
            at org.gradle.execution.taskgraph.DefaultTaskGraphExecuter$EventFiringTaskWorker.execute(DefaultTaskGraphExecuter.java:203)
            at org.gradle.execution.taskgraph.DefaultTaskGraphExecuter$EventFiringTaskWorker.execute(DefaultTaskGraphExecuter.java:185)
            at org.gradle.execution.taskgraph.AbstractTaskPlanExecutor$TaskExecutorWorker.processTask(AbstractTaskPlanExecutor.java:66)
            at org.gradle.execution.taskgraph.AbstractTaskPlanExecutor$TaskExecutorWorker.run(AbstractTaskPlanExecutor.java:50)
            at org.gradle.execution.taskgraph.DefaultTaskPlanExecutor.process(DefaultTaskPlanExecutor.java:25)
            at org.gradle.execution.taskgraph.DefaultTaskGraphExecuter.execute(DefaultTaskGraphExecuter.java:110)
            at org.gradle.execution.SelectedTaskExecutionAction.execute(SelectedTaskExecutionAction.java:37)
            at org.gradle.execution.DefaultBuildExecuter.execute(DefaultBuildExecuter.java:37)
            at org.gradle.execution.DefaultBuildExecuter.access$000(DefaultBuildExecuter.java:23)
            at org.gradle.execution.DefaultBuildExecuter$1.proceed(DefaultBuildExecuter.java:43)
            at org.gradle.execution.DryRunBuildExecutionAction.execute(DryRunBuildExecutionAction.java:32)
            at org.gradle.execution.DefaultBuildExecuter.execute(DefaultBuildExecuter.java:37)
            at org.gradle.execution.DefaultBuildExecuter.execute(DefaultBuildExecuter.java:30)
            at org.gradle.initialization.DefaultGradleLauncher$4.run(DefaultGradleLauncher.java:154)
            at org.gradle.internal.Factories$1.create(Factories.java:22)
            at org.gradle.internal.progress.DefaultBuildOperationExecutor.run(DefaultBuildOperationExecutor.java:90)
            at org.gradle.internal.progress.DefaultBuildOperationExecutor.run(DefaultBuildOperationExecutor.java:52)
            at org.gradle.initialization.DefaultGradleLauncher.doBuildStages(DefaultGradleLauncher.java:151)
            at org.gradle.initialization.DefaultGradleLauncher.access$200(DefaultGradleLauncher.java:32)
            at org.gradle.initialization.DefaultGradleLauncher$1.create(DefaultGradleLauncher.java:99)
            at org.gradle.initialization.DefaultGradleLauncher$1.create(DefaultGradleLauncher.java:93)
            at org.gradle.internal.progress.DefaultBuildOperationExecutor.run(DefaultBuildOperationExecutor.java:90)
            at org.gradle.internal.progress.DefaultBuildOperationExecutor.run(DefaultBuildOperationExecutor.java:62)
            at org.gradle.initialization.DefaultGradleLauncher.doBuild(DefaultGradleLauncher.java:93)
            at org.gradle.initialization.DefaultGradleLauncher.run(DefaultGradleLauncher.java:82)
            at org.gradle.launcher.exec.InProcessBuildActionExecuter$DefaultBuildController.run(InProcessBuildActionExecuter.java:94)
            at org.gradle.tooling.internal.provider.ExecuteBuildActionRunner.run(ExecuteBuildActionRunner.java:28)
            at org.gradle.launcher.exec.ChainingBuildActionRunner.run(ChainingBuildActionRunner.java:35)
            at org.gradle.launcher.exec.InProcessBuildActionExecuter.execute(InProcessBuildActionExecuter.java:43)
            at org.gradle.launcher.exec.InProcessBuildActionExecuter.execute(InProcessBuildActionExecuter.java:28)
            at org.gradle.launcher.exec.ContinuousBuildActionExecuter.execute(ContinuousBuildActionExecuter.java:78)
            at org.gradle.launcher.exec.ContinuousBuildActionExecuter.execute(ContinuousBuildActionExecuter.java:48)
            at org.gradle.launcher.daemon.server.exec.ExecuteBuild.doBuild(ExecuteBuild.java:52)
            at org.gradle.launcher.daemon.server.exec.BuildCommandOnly.execute(BuildCommandOnly.java:36)
            at org.gradle.launcher.daemon.server.api.DaemonCommandExecution.proceed(DaemonCommandExecution.java:120)
            at org.gradle.launcher.daemon.server.exec.WatchForDisconnection.execute(WatchForDisconnection.java:37)
            at org.gradle.launcher.daemon.server.api.DaemonCommandExecution.proceed(DaemonCommandExecution.java:120)
            at org.gradle.launcher.daemon.server.exec.ResetDeprecationLogger.execute(ResetDeprecationLogger.java:26)
            at org.gradle.launcher.daemon.server.api.DaemonCommandExecution.proceed(DaemonCommandExecution.java:120)
            at org.gradle.launcher.daemon.server.exec.RequestStopIfSingleUsedDaemon.execute(RequestStopIfSingleUsedDaemon.java:34)
            at org.gradle.launcher.daemon.server.api.DaemonCommandExecution.proceed(DaemonCommandExecution.java:120)
            at org.gradle.launcher.daemon.server.exec.ForwardClientInput$2.call(ForwardClientInput.java:74)
            at org.gradle.launcher.daemon.server.exec.ForwardClientInput$2.call(ForwardClientInput.java:72)
            at org.gradle.util.Swapper.swap(Swapper.java:38)
            at org.gradle.launcher.daemon.server.exec.ForwardClientInput.execute(ForwardClientInput.java:72)
            at org.gradle.launcher.daemon.server.api.DaemonCommandExecution.proceed(DaemonCommandExecution.java:120)
            at org.gradle.launcher.daemon.server.health.DaemonHealthTracker.execute(DaemonHealthTracker.java:47)
            at org.gradle.launcher.daemon.server.api.DaemonCommandExecution.proceed(DaemonCommandExecution.java:120)
            at org.gradle.launcher.daemon.server.exec.LogToClient.doBuild(LogToClient.java:66)
            at org.gradle.launcher.daemon.server.exec.BuildCommandOnly.execute(BuildCommandOnly.java:36)
            at org.gradle.launcher.daemon.server.api.DaemonCommandExecution.proceed(DaemonCommandExecution.java:120)
            at org.gradle.launcher.daemon.server.exec.EstablishBuildEnvironment.doBuild(EstablishBuildEnvironment.java:72)
            at org.gradle.launcher.daemon.server.exec.BuildCommandOnly.execute(BuildCommandOnly.java:36)
            at org.gradle.launcher.daemon.server.api.DaemonCommandExecution.proceed(DaemonCommandExecution.java:120)
            at org.gradle.launcher.daemon.server.health.HintGCAfterBuild.execute(HintGCAfterBuild.java:41)
            at org.gradle.launcher.daemon.server.api.DaemonCommandExecution.proceed(DaemonCommandExecution.java:120)
            at org.gradle.launcher.daemon.server.exec.StartBuildOrRespondWithBusy$1.run(StartBuildOrRespondWithBusy.java:50)
            at org.gradle.launcher.daemon.server.DaemonStateCoordinator$1.run(DaemonStateCoordinator.java:246)
            at org.gradle.internal.concurrent.ExecutorPolicy$CatchAndRecordFailures.onExecute(ExecutorPolicy.java:54)
            at org.gradle.internal.concurrent.StoppableExecutorImpl$1.run(StoppableExecutorImpl.java:40)
    Caused by: java.lang.RuntimeException: com.android.build.api.transform.TransformException: com.android.ide.common.process.ProcessException: java.util.concurrent.ExecutionException: com.android.ide.common.process.ProcessException: org.gradle.process.internal.ExecException: Process 'command '/Library/Java/JavaVirtualMachines/jdk1.8.0_73.jdk/Contents/Home/bin/java'' finished with non-zero exit value 1
            at com.android.builder.profile.Recorder$Block.handleException(Recorder.java:54)
            at com.android.builder.profile.ThreadRecorder$1.record(ThreadRecorder.java:57)
            at com.android.builder.profile.ThreadRecorder$1.record(ThreadRecorder.java:47)
            at com.android.build.gradle.internal.pipeline.TransformTask.transform(TransformTask.java:173)
            at org.gradle.internal.reflect.JavaMethod.invoke(JavaMethod.java:75)
            at org.gradle.api.internal.project.taskfactory.AnnotationProcessingTaskFactory$IncrementalTaskAction.doExecute(AnnotationProcessingTaskFactory.java:244)
            at org.gradle.api.internal.project.taskfactory.AnnotationProcessingTaskFactory$StandardTaskAction.execute(AnnotationProcessingTaskFactory.java:220)
            at org.gradle.api.internal.project.taskfactory.AnnotationProcessingTaskFactory$IncrementalTaskAction.execute(AnnotationProcessingTaskFactory.java:231)
            at org.gradle.api.internal.project.taskfactory.AnnotationProcessingTaskFactory$StandardTaskAction.execute(AnnotationProcessingTaskFactory.java:209)
            at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.executeAction(ExecuteActionsTaskExecuter.java:80)
            at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.executeActions(ExecuteActionsTaskExecuter.java:61)
            ... 68 more
    Caused by: com.android.build.api.transform.TransformException: com.android.ide.common.process.ProcessException: java.util.concurrent.ExecutionException: com.android.ide.common.process.ProcessException: org.gradle.process.internal.ExecException: Process 'command '/Library/Java/JavaVirtualMachines/jdk1.8.0_73.jdk/Contents/Home/bin/java'' finished with non-zero exit value 1
            at com.android.build.gradle.internal.transforms.DexTransform.transform(DexTransform.java:422)
            at com.android.build.gradle.internal.pipeline.TransformTask$3.call(TransformTask.java:178)
            at com.android.build.gradle.internal.pipeline.TransformTask$3.call(TransformTask.java:174)
            at com.android.builder.profile.ThreadRecorder$1.record(ThreadRecorder.java:55)
            ... 77 more
    Caused by: com.android.ide.common.process.ProcessException: java.util.concurrent.ExecutionException: com.android.ide.common.process.ProcessException: org.gradle.process.internal.ExecException: Process 'command '/Library/Java/JavaVirtualMachines/jdk1.8.0_73.jdk/Contents/Home/bin/java'' finished with non-zero exit value 1
            at com.android.builder.core.AndroidBuilder.runDexer(AndroidBuilder.java:1472)
            at com.android.builder.core.AndroidBuilder.convertByteCode(AndroidBuilder.java:1389)
            at com.android.build.gradle.internal.transforms.DexTransform.transform(DexTransform.java:250)
            ... 80 more
    Caused by: java.util.concurrent.ExecutionException: com.android.ide.common.process.ProcessException: org.gradle.process.internal.ExecException: Process 'command '/Library/Java/JavaVirtualMachines/jdk1.8.0_73.jdk/Contents/Home/bin/java'' finished with non-zero exit value 1
            at com.android.builder.core.AndroidBuilder.runDexer(AndroidBuilder.java:1456)
            ... 82 more
    Caused by: com.android.ide.common.process.ProcessException: org.gradle.process.internal.ExecException: Process 'command '/Library/Java/JavaVirtualMachines/jdk1.8.0_73.jdk/Contents/Home/bin/java'' finished with non-zero exit value 1
            at com.android.build.gradle.internal.process.GradleProcessResult.assertNormalExitValue(GradleProcessResult.java:43)
            at com.android.builder.core.AndroidBuilder$2.call(AndroidBuilder.java:1464)
            at com.android.builder.core.AndroidBuilder$2.call(AndroidBuilder.java:1456)
    Caused by: org.gradle.process.internal.ExecException: Process 'command '/Library/Java/JavaVirtualMachines/jdk1.8.0_73.jdk/Contents/Home/bin/java'' finished with non-zero exit value 1
            at org.gradle.process.internal.DefaultExecHandle$ExecResultImpl.assertNormalExitValue(DefaultExecHandle.java:367)
            at com.android.build.gradle.internal.process.GradleProcessResult.assertNormalExitValue(GradleProcessResult.java:41)
            ... 2 more

I am using

Android Studio 2.0 Beta 6

Java version: Java(TM) SE Runtime Environment (build 1.8.0_73-b02)

Gradle Version: com.android.tools.build:gradle:2.0.0-beta6

And i have Multidex enabled

My build.gradle file

apply plugin: 'com.android.application'
apply plugin: 'com.getkeepsafe.dexcount'

android {

    def VERSION_CODE = 52
    def VERSION_NAME = "1.0"
    compileSdkVersion 23
    buildToolsVersion '23.0.2'

    defaultConfig {
        applicationId "com.example.app"
        manifestPlaceholders = [appName: "Personal App"]
        minSdkVersion 14
        targetSdkVersion 23
        renderscriptTargetApi 19
        renderscriptSupportModeEnabled true
        versionCode VERSION_CODE
        versionName VERSION_NAME

        // Enabling multidex support.
        multiDexEnabled true
    }

    compileOptions {
        sourceCompatibility JavaVersion.VERSION_1_7
        targetCompatibility JavaVersion.VERSION_1_7
        encoding = 'UTF-8'
    }

    signingConfigs {
        livekeystore {
            storeFile file('../key.jks')
            keyAlias 'livekeystore'
            keyPassword '123asd'
            storePassword '123asd'
        }
    }

    buildTypes {
        release {
            minifyEnabled true
            shrinkResources true
            zipAlignEnabled true
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.txt'
            signingConfig signingConfigs.burgerking

            manifestPlaceholders = [googleMapsKey: "@string/release_google_map_key", appNameSuffix: ""]
        }

        debug {
            applicationIdSuffix '.dev'
            debuggable true
            minifyEnabled false
            shrinkResources false
            zipAlignEnabled false

            manifestPlaceholders = [googleMapsKey: "@string/debug_google_map_key", appNameSuffix: ' (Dev-' + VERSION_CODE + ')']

        }
    }

    dexOptions {
        incremental true
        javaMaxHeapSize "4g" // 2g should be also OK
    }

    useLibrary 'org.apache.http.legacy'

}

repositories {
    maven { url 'https://mint.splunk.com/gradle/' }
    maven { url "http://dl.bintray.com/populov/maven" }
    mavenCentral()
}

buildscript {
    repositories {
        mavenCentral()
    }

    dependencies {
        classpath 'com.getkeepsafe.dexcount:dexcount-gradle-plugin:0.4.2'
        classpath 'com.newrelic.agent.android:agent-gradle-plugin:4.244.0'
    }
}

dependencies {
    compile 'com.google.code.gson:gson:2.4'
    compile 'com.android.support:appcompat-v7:23.2.0'
    compile 'com.android.support:recyclerview-v7:23.2.0'
    compile 'com.android.support:cardview-v7:23.2.0'
    compile 'com.android.support:design:23.2.0'
    compile 'com.android.support:multidex:1.0.1'
    compile 'com.google.android.gms:play-services-base:8.4.0'
    compile 'com.google.android.gms:play-services-location:8.4.0'
    compile 'com.google.android.gms:play-services-analytics:8.4.0'
    compile 'com.google.android.gms:play-services-maps:8.4.0'
    compile 'com.google.android.gms:play-services-ads:8.4.0'
    compile 'com.googlecode.libphonenumber:libphonenumber:7.0.5'
    compile 'com.facebook.android:facebook-android-sdk:4.1.1'
    compile 'de.greenrobot:eventbus:2.4.0'
    compile 'com.viewpagerindicator:library:2.4.1@aar'
    compile 'com.nineoldandroids:library:2.4.0'
    compile 'com.squareup.picasso:picasso:2.5.2'
    compile 'com.squareup:pollexor:2.0.2'
    compile 'com.makeramen:roundedimageview:2.1.0'
    compile 'com.mcxiaoke.volley:library:1.0.16@aar'
    compile files('libs/now-auth-api.jar')
    compile 'com.jakewharton:butterknife:5.1.2'
    compile 'com.github.ksoichiro:android-observablescrollview:1.2.0'
    compile 'io.card:android-sdk:5.3.0'
    compile 'com.appboy:android-sdk-ui:1.10.3'
    testCompile 'junit:junit:4.11'
    testCompile('org.mockito:mockito-core:1.9.5') {
        exclude group: 'org.hamcrest'
    }
    testCompile('org.powermock:powermock-module-junit4:1.5') {
        exclude group: 'org.hamcrest'
    }
    testCompile('org.powermock:powermock-api-mockito:1.6.2') {
        exclude group: 'org.hamcrest'
    }

    compile 'me.grantland:autofittextview:0.2.1'

}

It seems i am able to get my release build working if i remove minifyEnabled true from it. Why is that, is there another way to solve it


来源: stackexchange

问:
Angular Material Snackbar Change Color
I'm using Angular 7 with Material Snackbar. I want to changes the color of Snackbar to green.

In app.component.ts, I have:

```<code>this.snackBarRef = this.snackBar.open(result.localized_message, 'X', {
    duration: 4000,
    verticalPosition: 'top',
    panelClass: 'notif-success'
});

this.snackBarRef.onAction().subscribe(() => {
    this.snackBarRef.dismiss();
});
</code>```

In app.component.scss, I have:

```<code>.notif-success {
    color: #155724 !important; // green
    background-color: #d4edda !important;
    border-color: #c3e6cb !important;
    .mat-simple-snackbar-action {
        color: #155724 !important;
    }
}
</code>```

But the Snackbar is still shown in its default colors.

I can see that the notif-success class has been applied to the snackbar

```<code><snack-bar-container class="mat-snack-bar-container ng-tns-c18-84 ng-trigger ng-trigger-state notif-success mat-snack-bar-center mat-snack-bar-top ng-star-inserted" role="status" style="transform: scale(1); opacity: 1;">
</code>```

Why is the custom css not working?

答:
This is what you're looking for:

```<code>::ng-deep .mat-snack-bar-container{
  color: #155724 !important;
  background-color: #d4edda !important;
  border-color: #c3e6cb !important;
}
::ng-deep .mat-simple-snackbar-action {
  color: red;
}
</code>```

complete working demo here

ContentLicense: CC BY-SA 4.0

Title: Angular Material Snackbar Change Color

Body:
I'm using Angular 7 with Material Snackbar. I want to changes the color of Snackbar to green.

In app.component.ts, I have:

this.snackBarRef = this.snackBar.open(result.localized_message, 'X', {
    duration: 4000,
    verticalPosition: 'top',
    panelClass: 'notif-success'
});

this.snackBarRef.onAction().subscribe(() => {
    this.snackBarRef.dismiss();
});

In app.component.scss, I have:

.notif-success {
    color: #155724 !important; // green
    background-color: #d4edda !important;
    border-color: #c3e6cb !important;
    .mat-simple-snackbar-action {
        color: #155724 !important;
    }
}

But the Snackbar is still shown in its default colors.

I can see that the notif-success class has been applied to the snackbar

<snack-bar-container class="mat-snack-bar-container ng-tns-c18-84 ng-trigger ng-trigger-state notif-success mat-snack-bar-center mat-snack-bar-top ng-star-inserted" role="status" style="transform: scale(1); opacity: 1;">

Why is the custom css not working?

Body:
This is what you're looking for:

::ng-deep .mat-snack-bar-container{
  color: #155724 !important;
  background-color: #d4edda !important;
  border-color: #c3e6cb !important;
}
::ng-deep .mat-simple-snackbar-action {
  color: red;
}

complete working demo here


问:
Flexbox item does not shrink when only one item
In flexbox, if you set flex-flow: column nowrap and the elements inside have non-zero value of flex shrink, they should shrink down to all fit inside the flex container.

I have found that if you have only one item in this container and it has content bigger than the flex-container then it will not shrink down. But if other elements are included in the container (if it is not the only item) then it will shrink down.

Best visualized in this CodePen.

Here is the same code from the CodePen.

.container {
  padding: 10px;
  height: 100px;
  width: 100px;
  background: red;
  margin: 5px 20px;
  display: flex;
  flex-flow: column nowrap;
  align-items: center;
}

.item {
  width: 80px;
  height: 40px;
  background: blue;
  margin: 5px;
  /* same as
  flex: 1 1 40px;
  */
}

.super.item {
  height: 200px;
}

.item div {
  width: 10px;
  height: 150px;
  background: black;
}

body {
  margin: 0;
  display: flex;
}```
<pre class="snippet-code-html lang-html prettyprint-override"><code><div class='container'>
  <div class='item'></div>
  <div class='item'></div>
  <div class='item'></div>
  <div class='item'>
  </div>
</div>

<div class='container'>
  <div class='item'></div>
  <div class='item'></div>
  <div class='item'></div>
  <div class='item'>
    <div></div>
  </div>
</div>

<div class='container'>
  <div class='item super'>
  </div>
</div>

<div class='container'>
  <div class='item super'>
    <div></div>
  </div>
</div></code>```

Is there an explanation on why that last div does not shrink to fit the flex container?

答:
What about making the height of those contents inherit their parent's one?

```<code>.super.item {
  height: inherit;
}
.item div {
  width: 10px;
  height: inherit;
  background: black;
}
</code>```

Snippet below, is that what you're trying to achieve? :

.container {
  padding: 10px;
  height: 100px;
  width: 100px;
  background: red;
  margin: 5px 20px;
  display: flex;
  flex-flow: column nowrap;
  align-items: center;
}

.item {
  width: 80px;
  height: 40px;
  background: blue;
  margin: 5px;
  /* same as
  flex: 1 1 40px;
  */
}

.super.item {
  height: inherit;
}

.item div {
  width: 10px;
  height: inherit;
  background: black;
}

body {
  margin: 0;
  display: flex;
}```
<pre class="snippet-code-html lang-html prettyprint-override"><code><div class='container'>
  <div class='item'></div>
  <div class='item'></div>
  <div class='item'></div>
  <div class='item'>
  </div>
</div>

<div class='container'>
  <div class='item'></div>
  <div class='item'></div>
  <div class='item'></div>
  <div class='item'>
    <div></div>
  </div>
</div>

<div class='container'>
  <div class='item super'>
  </div>
</div>

<div class='container'>
  <div class='item super'>
    <div></div>
  </div>
</div></code>```

Body:
In flexbox, if you set flex-flow: column nowrap and the elements inside have non-zero value of flex shrink, they should shrink down to all fit inside the flex container.

I have found that if you have only one item in this container and it has content bigger than the flex-container then it will not shrink down. But if other elements are included in the container (if it is not the only item) then it will shrink down.

Best visualized in this CodePen.

Here is the same code from the CodePen.

.container {
  padding: 10px;
  height: 100px;
  width: 100px;
  background: red;
  margin: 5px 20px;
  display: flex;
  flex-flow: column nowrap;
  align-items: center;
}

.item {
  width: 80px;
  height: 40px;
  background: blue;
  margin: 5px;
  /* same as
  flex: 1 1 40px;
  */
}

.super.item {
  height: 200px;
}

.item div {
  width: 10px;
  height: 150px;
  background: black;
}

body {
  margin: 0;
  display: flex;
}

Is there an explanation on why that last div does not shrink to fit the flex container?

Body:
What about making the height of those contents inherit their parent's one?

.super.item {
  height: inherit;
}
.item div {
  width: 10px;
  height: inherit;
  background: black;
}

Snippet below, is that what you're trying to achieve? :

.container {
  padding: 10px;
  height: 100px;
  width: 100px;
  background: red;
  margin: 5px 20px;
  display: flex;
  flex-flow: column nowrap;
  align-items: center;
}

.item {
  width: 80px;
  height: 40px;
  background: blue;
  margin: 5px;
  /* same as
  flex: 1 1 40px;
  */
}

.super.item {
  height: inherit;
}

.item div {
  width: 10px;
  height: inherit;
  background: black;
}

body {
  margin: 0;
  display: flex;
}

<div class='container'>
  <div class='item'></div>
  <div class='item'></div>
  <div class='item'></div>
  <div class='item'>
  </div>
</div>

<div class='container'>
  <div class='item'></div>
  <div class='item'></div>
  <div class='item'></div>
  <div class='item'>
    <div></div>
  </div>
</div>

<div class='container'>
  <div class='item super'>
  </div>
</div>

<div class='container'>
  <div class='item super'>
    <div></div>
  </div>
</div>


问:
How should be the regex for alphanumeric where alphabet only with combinations of"w" or "d" or "h"
I need the regex to validate the user entered string, the string may be of following formats.

ex: 1w 2d 1h or 2w 1h or 1w 2d. Likewise combinations of numbers and w,d and h.

I am looking for the regex to allow the combinations number and w or d or h.

Is it possible to have a regex like that way?

答:
You could say you want

\d+ any number, 1 or more times

[wdh] one of w, d, h

(?: |$) space or end of string

Then put this in a group, loop it 1 or more times

(?: start of non-capture group

)+ end of non-capture group, 1 or more times

^ and $ start and end of string respectively

Result

```<code>^(?:\d+[wdh](?: |$))+$
</code>```

Edit: I see you've added more requirements in the comments of your question, this regex will not fulfil your most recent requirements

Body:
You could say you want

\d+ any number, 1 or more times

[wdh] one of w, d, h

(?: |$) space or end of string

Then put this in a group, loop it 1 or more times

(?: start of non-capture group

)+ end of non-capture group, 1 or more times

^ and $ start and end of string respectively

Result

^(?:\d+[wdh](?: |$))+$

Edit: I see you've added more requirements in the comments of your question, this regex will not fulfil your most recent requirements


问:
compare string column with other column by row wise
I have a data frame as below,how to compare values from 2 columns.i.e row 1 has common string("SZY")in both col a & b and extra in string in col a (ABC)
for row 5 common string is "BNM" and extra strings in both col a and b.

```<code>a=c("ABC,SZY","XYZ",NA,NA,"ABC,BNM,JKL","DEF","XCV")
b=c("SZY","XYZ,IOP","QWE",NA,"BNM,JKL,STU","DEF","HJK")
df = data.frame(a,b)
</code>```

output should be as follows

```<code>output = c("COMMON+column_a","COMMON+column_b","DIFFERENT",NA,"COMMON+column_a+column_b","COMMON","DIFFERENT")
df = cbind(df,output)
</code>```

答:
Using base R apply we can split the strings on comma, delete NA entries, keep only unique values convert them to comma separated string again.

```<code>df$output <- apply(df, 1, function(x)
                  toString(unique(na.omit(unlist(strsplit(x, ","))))))

df
#            a           b             output
#1     ABC,SZY         SZY           ABC, SZY
#2         XYZ     XYZ,IOP           XYZ, IOP
#3        <NA>         QWE                QWE
#4        <NA>        <NA>
#5 ABC,BNM,JKL BNM,JKL,STU ABC, BNM, JKL, STU
#6         DEF         DEF                DEF
#7         XCV         HJK           XCV, HJK
</code>```

Body:
I have a data frame as below,how to compare values from 2 columns.i.e row 1 has common string("SZY")in both col a & b and extra in string in col a (ABC)
for row 5 common string is "BNM" and extra strings in both col a and b.

a=c("ABC,SZY","XYZ",NA,NA,"ABC,BNM,JKL","DEF","XCV")
b=c("SZY","XYZ,IOP","QWE",NA,"BNM,JKL,STU","DEF","HJK")
df = data.frame(a,b)

output should be as follows

output = c("COMMON+column_a","COMMON+column_b","DIFFERENT",NA,"COMMON+column_a+column_b","COMMON","DIFFERENT")
df = cbind(df,output)

Body:
Using base R apply we can split the strings on comma, delete NA entries, keep only unique values convert them to comma separated string again.

df$output <- apply(df, 1, function(x)
                  toString(unique(na.omit(unlist(strsplit(x, ","))))))

df
#            a           b             output
#1     ABC,SZY         SZY           ABC, SZY
#2         XYZ     XYZ,IOP           XYZ, IOP
#3        <NA>         QWE                QWE
#4        <NA>        <NA>
#5 ABC,BNM,JKL BNM,JKL,STU ABC, BNM, JKL, STU
#6         DEF         DEF                DEF
#7         XCV         HJK           XCV, HJK


问:
org.gradle.api.tasks.TaskExecutionException: Execution failed for task ':app:transformClassesWithDexForDebug'
Due to 65K error in my project I need it to migrate to Android Studio . While running

./gradlew assembleDebug

I am getting the error:

```<code>Execution failed for task ':app:transformClassesWithDexForDebug'.
com.android.build.api.transform.TransformException:
com.android.ide.common.process.ProcessException:
java.util.concurrent.ExecutionException:
com.android.ide.common.process.ProcessException:
org.gradle.process.internal.ExecException:
Process 'command '/opt/jdk/jdk1.8.0_45/bin/java'' finished with non-zero exit value 1
</code>```

I know this is very common error which all get while migrating an Eclipse project to Android Studio.

I have tried:

Execution failed for task ':app:transformClassesWithDexForDebug' - Gradle dependencies?

Execution failed for task ':app:transformClassesWithDexForDebug' while implementing Google sign in for Android

Android Studio TransformException : Error:Execution failed for task ':app:transformClassesWithDexForDebug'

Error:Execution failed for task ':app:transformClassesWithDexForDebug'

com.android.build.transform.api.TransformException

https://github.com/journeyapps/zxing-android-embedded/issues/110

I tried every solution, I tried to add .jar files one by one in my project, I used only those Google-services packages which are getting used in my project, I even added multidex jar.But nothing helps me

My Build.gradle file:

```<code>apply plugin: 'com.android.application'

android {
    compileSdkVersion 23
    buildToolsVersion "23.0.3"

    defaultConfig {
        applicationId "com.petzview.android"
        minSdkVersion 15
        targetSdkVersion 23
        versionCode 1
        versionName "1.0"
    }
    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
    }
    lintOptions {
        abortOnError false
        checkReleaseBuilds false
    }

    dexOptions {
        incremental = true;
        maxProcessCount 4
        javaMaxHeapSize "4g"
        dexInProcess = false
        preDexLibraries = false
    }
}

dependencies {
    compile fileTree(include: ['*.jar'], dir: 'libs')
    testCompile 'junit:junit:4.12'
    compile 'com.android.support:appcompat-v7:23.4.0'
    compile 'com.google.android.gms:play-services-ads:9.0.0'
    compile 'com.google.android.gms:play-services-plus:9.0.0'
    compile 'com.google.android.gms:play-services-gcm:9.0.0'
    compile project(':AVIOCtrlDefine')
    compile project(':Facebook')
    compile project(':SlidingMenu-master')
    compile 'com.android.support:multidex:1.0.1'
}
android.packagingOptions {
    exclude 'the META-INF / DEPENDENCIES'
    exclude 'META-INF/DEPENDENCIES.txt'
    exclude 'the META-INF / LICENSE'
    exclude 'the META-INF / LICENSE.txt'
    exclude 'the META-INF / license.txt'
    exclude 'the META-INF / NOTICE'
    exclude 'the META-INF / the NOTICE.txt '
    exclude ' the META-INF / NOTICE.txt '
    exclude ' the META-INF / ASL2.0 '
    exclude ' the META-INF / Services / javax.annotation.processing.Processor '
}
apply plugin: 'com.google.gms.google-services'
</code>```

My main gradle file:

```<code>buildscript {
    repositories {
        jcenter()
    }
    dependencies {
       classpath 'com.android.tools.build:gradle:2.1.0'
       classpath 'com.google.gms:google-services:3.0.0'
    }
}

allprojects {
    repositories {
        jcenter()
    }
}
</code>```

Screenshot of my libs folder:

MyApplication.java:

```<code>public class MyApplication extends MultiDexApplication {
    private Object mTempObject = null;

    private boolean flagHomeFragmentFirstCreate = true;

    @Override
    protected void attachBaseContext(Context base) {
        super.attachBaseContext(base);
        MultiDex.install(this);
        FacebookSdk.sdkInitialize(getApplicationContext());
    }
</code>```

My Manifest class containing MyApplication:

```<code> <application
        android:name=".MyApplication"
        android:allowBackup="true"
        android:icon="@drawable/ic_launcher"
        android:label="@string/app_name"
        android:largeHeap="true"
        android:theme="@style/AppTheme">
</code>```

After running

./gradlew assembleDebug --stacktrace

Error Log

```<code>org.gradle.api.tasks.TaskExecutionException: Execution failed for task ':app:transformClassesWithDexForDebug'.
at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.executeActions(ExecuteActionsTaskExecuter.java:69)
at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.execute(ExecuteActionsTaskExecuter.java:46)
at org.gradle.api.internal.tasks.execution.PostExecutionAnalysisTaskExecuter.execute(PostExecutionAnalysisTaskExecuter.java:35)
at org.gradle.api.internal.tasks.execution.SkipUpToDateTaskExecuter.execute(SkipUpToDateTaskExecuter.java:64)
at org.gradle.api.internal.tasks.execution.ValidatingTaskExecuter.execute(ValidatingTaskExecuter.java:58)
at org.gradle.api.internal.tasks.execution.SkipEmptySourceFilesTaskExecuter.execute(SkipEmptySourceFilesTaskExecuter.java:52)
at org.gradle.api.internal.tasks.execution.SkipTaskWithNoActionsExecuter.execute(SkipTaskWithNoActionsExecuter.java:52)
at org.gradle.api.internal.tasks.execution.SkipOnlyIfTaskExecuter.execute(SkipOnlyIfTaskExecuter.java:53)
at org.gradle.api.internal.tasks.execution.ExecuteAtMostOnceTaskExecuter.execute(ExecuteAtMostOnceTaskExecuter.java:43)
at org.gradle.execution.taskgraph.DefaultTaskGraphExecuter$EventFiringTaskWorker.execute(DefaultTaskGraphExecuter.java:203)
at org.gradle.execution.taskgraph.DefaultTaskGraphExecuter$EventFiringTaskWorker.execute(DefaultTaskGraphExecuter.java:185)
at org.gradle.execution.taskgraph.AbstractTaskPlanExecutor$TaskExecutorWorker.processTask(AbstractTaskPlanExecutor.java:66)
at org.gradle.execution.taskgraph.AbstractTaskPlanExecutor$TaskExecutorWorker.run(AbstractTaskPlanExecutor.java:50)
at org.gradle.execution.taskgraph.DefaultTaskPlanExecutor.process(DefaultTaskPlanExecutor.java:25)
at org.gradle.execution.taskgraph.DefaultTaskGraphExecuter.execute(DefaultTaskGraphExecuter.java:110)
at org.gradle.execution.SelectedTaskExecutionAction.execute(SelectedTaskExecutionAction.java:37)
         org.gradle.execution.DefaultBuildExecuter.execute(DefaultBuildExecuter.java:37)
at org.gradle.execution.DefaultBuildExecuter.access$000(DefaultBuildExecuter.java:23)
at org.gradle.execution.DefaultBuildExecuter$1.proceed(DefaultBuildExecuter.java:43)
at org.gradle.execution.DryRunBuildExecutionAction.execute(DryRunBuildExecutionAction.java:32)
at org.gradle.execution.DefaultBuildExecuter.execute(DefaultBuildExecuter.java:37)
at org.gradle.execution.DefaultBuildExecuter.execute(DefaultBuildExecuter.java:30)
at org.gradle.initialization.DefaultGradleLauncher$4.run(DefaultGradleLauncher.java:154)
at org.gradle.internal.Factories$1.create(Factories.java:22)
at org.gradle.internal.progress.DefaultBuildOperationExecutor.run(DefaultBuildOperationExecutor.java:90)
at org.gradle.internal.progress.DefaultBuildOperationExecutor.run(DefaultBuildOperationExecutor.java:52)
at org.gradle.initialization.DefaultGradleLauncher.doBuildStages(DefaultGradleLauncher.java:151)
at org.gradle.initialization.DefaultGradleLauncher.access$200(DefaultGradleLauncher.java:32)
at org.gradle.initialization.DefaultGradleLauncher$1.create(DefaultGradleLauncher.java:99)
at org.gradle.initialization.DefaultGradleLauncher$1.create(DefaultGradleLauncher.java:93)
at org.gradle.internal.progress.DefaultBuildOperationExecutor.run(DefaultBuildOperationExecutor.java:90)
at org.gradle.internal.progress.DefaultBuildOperationExecutor.run(DefaultBuildOperationExecutor.java:62)
at org.gradle.initialization.DefaultGradleLauncher.doBuild(DefaultGradleLauncher.java:93)
at org.gradle.initialization.DefaultGradleLauncher.run(DefaultGradleLauncher.java:82)
at org.gradle.launcher.exec.InProcessBuildActionExecuter$DefaultBuildController.run(InProcessBuildActionExecuter.java:94)
at org.gradle.tooling.internal.provider.ExecuteBuildActionRunner.run(ExecuteBuildActionRunner.java:28)
at org.gradle.launcher.exec.ChainingBuildActionRunner.run(ChainingBuildActionRunner.java:35)
at org.gradle.launcher.exec.InProcessBuildActionExecuter.execute(InProcessBuildActionExecuter.java:43)
at org.gradle.launcher.exec.InProcessBuildActionExecuter.execute(InProcessBuildActionExecuter.java:28)
at org.gradle.launcher.exec.ContinuousBuildActionExecuter.execute(ContinuousBuildActionExecuter.java:78)
at org.gradle.launcher.exec.ContinuousBuildActionExecuter.execute(ContinuousBuildActionExecuter.java:48)
at org.gradle.launcher.exec.DaemonUsageSuggestingBuildActionExecuter.execute(DaemonUsageSuggestingBuildActionExecuter.java:51)
at org.gradle.launcher.exec.DaemonUsageSuggestingBuildActionExecuter.execute(DaemonUsageSuggestingBuildActionExecuter.java:28)
at org.gradle.launcher.cli.RunBuildAction.run(RunBuildAction.java:43)
at org.gradle.internal.Actions$RunnableActionAdapter.execute(Actions.java:170)
at org.gradle.launcher.cli.CommandLineActionFactory$ParseAndBuildAction.execute(CommandLineActionFactory.java:237)
at org.gradle.launcher.cli.CommandLineActionFactory$ParseAndBuildAction.execute(CommandLineActionFactory.java:210)
at org.gradle.launcher.cli.JavaRuntimeValidationAction.execute(JavaRuntimeValidationAction.java:35)
at org.gradle.launcher.cli.JavaRuntimeValidationAction.execute(JavaRuntimeValidationAction.java:24)
at org.gradle.launcher.cli.CommandLineActionFactory$WithLogging.execute(CommandLineActionFactory.java:206)
at org.gradle.launcher.cli.CommandLineActionFactory$WithLogging.execute(CommandLineActionFactory.java:169)
at org.gradle.launcher.cli.ExceptionReportingAction.execute(ExceptionReportingAction.java:33)
at org.gradle.launcher.cli.ExceptionReportingAction.execute(ExceptionReportingAction.java:22)
at org.gradle.launcher.Main.doAction(Main.java:33)
at org.gradle.launcher.bootstrap.EntryPoint.run(EntryPoint.java:45)
at org.gradle.launcher.bootstrap.ProcessBootstrap.runNoExit(ProcessBootstrap.java:54)
at org.gradle.launcher.bootstrap.ProcessBootstrap.run(ProcessBootstrap.java:35)
at org.gradle.launcher.GradleMain.main(GradleMain.java:23)
at org.gradle.wrapper.BootstrapMainStarter.start(BootstrapMainStarter.java:30)
at org.gradle.wrapper.WrapperExecutor.execute(WrapperExecutor.java:129)
at org.gradle.wrapper.GradleWrapperMain.main(GradleWrapperMain.java:61)
Caused by: java.lang.RuntimeException:
com.android.build.api.transform.TransformException:
com.android.ide.common.process.ProcessException:
java.util.concurrent.ExecutionException:
com.android.ide.common.process.ProcessException:
org.gradle.process.internal.ExecException: Process 'command
 '/opt/jdk/jdk1.8.0_45/bin/java'' finished with non-zero exit value 1
at com.android.builder.profile.Recorder$Block.handleException(Recorder.java:54)
at com.android.builder.profile.ThreadRecorder$1.record(ThreadRecorder.java:57)
at com.android.builder.profile.ThreadRecorder$1.record(ThreadRecorder.java:47)
at com.android.build.gradle.internal.pipeline.TransformTask.transform(TransformTask.java:173)
at org.gradle.internal.reflect.JavaMethod.invoke(JavaMethod.java:75)
at org.gradle.api.internal.project.taskfactory.AnnotationProcessingTaskFactory$IncrementalTaskAction.doExecute(AnnotationProcessingTaskFactory.java:244)
at org.gradle.api.internal.project.taskfactory.AnnotationProcessingTaskFactory$StandardTaskAction.execute(AnnotationProcessingTaskFactory.java:220)
at org.gradle.api.internal.project.taskfactory.AnnotationProcessingTaskFactory$IncrementalTaskAction.execute(AnnotationProcessingTaskFactory.java:231)
at org.gradle.api.internal.project.taskfactory.AnnotationProcessingTaskFactory$StandardTaskAction.execute(AnnotationProcessingTaskFactory.java:209)
at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.executeAction(ExecuteActionsTaskExecuter.java:80)
at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.executeActions(ExecuteActionsTaskExecuter.java:61)
         ... 60 more Caused by: com.android.build.api.transform.TransformException:> com.android.ide.common.process.ProcessException:
java.util.concurrent.ExecutionException:
com.android.ide.common.process.ProcessException:
org.gradle.process.internal.ExecException: Process 'command
 '/opt/jdk/jdk1.8.0_45/bin/java'' finished with non-zero exit value 1
at com.android.build.gradle.internal.transforms.DexTransform.transform(DexTransform.java:421)
at com.android.build.gradle.internal.pipeline.TransformTask$3.call(TransformTask.java:178)
at com.android.build.gradle.internal.pipeline.TransformTask$3.call(TransformTask.java:174)
at com.android.builder.profile.ThreadRecorder$1.record(ThreadRecorder.java:55)
         ... 69 more Caused by: com.android.ide.common.process.ProcessException:
java.util.concurrent.ExecutionException:
com.android.ide.common.process.ProcessException:
org.gradle.process.internal.ExecException: Process 'command
 '/opt/jdk/jdk1.8.0_45/bin/java'' finished with non-zero exit value 1
at com.android.builder.core.AndroidBuilder.dexOutOfProcess(AndroidBuilder.java:1553)
at com.android.builder.core.AndroidBuilder.runDexer(AndroidBuilder.java:1495)
at com.android.builder.core.AndroidBuilder.convertByteCode(AndroidBuilder.java:1482)
 at com.android.build.gradle.internal.transforms.DexTransform.transform(DexTransform.java:251)
         ... 72 more Caused by: java.util.concurrent.ExecutionException:
com.android.ide.common.process.ProcessException:
org.gradle.process.internal.ExecException: Process 'command
 '/opt/jdk/jdk1.8.0_45/bin/java'' finished with non-zero exit value 1
at com.android.builder.core.AndroidBuilder.dexOutOfProcess(AndroidBuilder.java:1549)
        ... 75 more Caused by: com.android.ide.common.process.ProcessException:
org.gradle.process.internal.ExecException: Process 'command
 '/opt/jdk/jdk1.8.0_45/bin/java'' finished with non-zero exit value 1
at com.android.build.gradle.internal.process.GradleProcessResult.assertNormalExitValue(GradleProcessResult.java:43)
at com.android.builder.core.AndroidBuilder$3.call(AndroidBuilder.java:1538)
at com.android.builder.core.AndroidBuilder$3.call(AndroidBuilder.java:1531)
Caused by: org.gradle.process.internal.ExecException: Process 'command
 '/opt/jdk/jdk1.8.0_45/bin/java'' finished with non-zero exit value 1
at org.gradle.process.internal.DefaultExecHandle$ExecResultImpl.assertNormalExitValue(DefaultExecHandle.java:367)
at com.android.build.gradle.internal.process.GradleProcessResult.assertNormalExitValue(GradleProcessResult.java:41)
         ... 2 more
</code>```

Error while running application on device:

Error:trouble processing "java/awt/font/NumericShaper.class":
  Error:Ill-advised or mistaken usage of a core class (java.* or
  javax.*) Error:when not building a core library. Error:This is often
  due to inadvertently including a core library file Error:in your
  application's project, when using an IDE (such as Error:Eclipse). If
  you are sure you're not intentionally defining a Error:core class,
  then this is the most likely explanation of what's Error:going on.
  Error:However, you might actually be trying to define a class in a
  core Error:namespace, the source of which you may have taken, for
  example, Error:from a non-Android virtual machine project. This will
  most Error:assuredly not work. At a minimum, it jeopardizes the
  Error:compatibility of your app with future versions of the platform.
  Error:It is also often of questionable legality. Error:If you really
  intend to build a core library -- which is only Error:appropriate as
  part of creating a full virtual machine Error:distribution, as opposed
  to compiling an application -- then use Error:the "--core-library"
  option to suppress this error message. Error:If you go ahead and use
  "--core-library" but are in fact Error:building an application, then
  be forewarned that your application Error:will still fail to build or
  run, at some point. Please be Error:prepared for angry customers who
  find, for example, that your Error:application ceases to function once
  they upgrade their operating Error:system. You will be to blame for
  this problem. Error:If you are legitimately using some code that
  happens to be in a Error:core package, then the easiest safe
  alternative you have is to Error:repackage that code. That is, move
  the classes in question into Error:your own package namespace. This
  means that they will never be in Error:conflict with core system
  classes. JarJar is a tool that may help Error:you in this endeavor. If
  you find that you cannot do this, then Error:that is an indication
  that the path you are on will ultimately Error:lead to pain,
  suffering, grief, and lamentation. Error:1 error; aborting
  Error:Execution failed for task
  ':app:transformClassesWithDexForDebug'.

com.android.build.api.transform.TransformException: com.android.ide.common.process.ProcessException:
    java.util.concurrent.ExecutionException:
    com.android.ide.common.process.ProcessException:
    org.gradle.process.internal.ExecException: Process 'command
    '/usr/lib/jvm/java-8-oracle/bin/java'' finished with non-zero exit
    value 1 Information:BUILD FAILED

Where am I going wrong?

答:
the steps I followed are:

close Android Studio (or IntelliJ IDEA)

in your project's directory:

delete .idea directory

delete .gradle directory

delete all .iml files

find . | grep -e .iml$ | xargs rm

use Android Studio to re-open the directory as a project

Terminal commands:

# close Android Studio
cd "your project's directory"
rm -rf ./.idea
rm -rf ./.gradle
find . | grep -e .iml$ | xargs rm
# use Android Studio to re-open the directory as a project
```

Body:
Due to 65K error in my project I need it to migrate to Android Studio . While running

./gradlew assembleDebug

I am getting the error:

Execution failed for task ':app:transformClassesWithDexForDebug'.
com.android.build.api.transform.TransformException:
com.android.ide.common.process.ProcessException:
java.util.concurrent.ExecutionException:
com.android.ide.common.process.ProcessException:
org.gradle.process.internal.ExecException:
Process 'command '/opt/jdk/jdk1.8.0_45/bin/java'' finished with non-zero exit value 1

I know this is very common error which all get while migrating an Eclipse project to Android Studio.

I have tried:

Execution failed for task ':app:transformClassesWithDexForDebug' - Gradle dependencies?

Execution failed for task ':app:transformClassesWithDexForDebug' while implementing Google sign in for Android

Android Studio TransformException : Error:Execution failed for task ':app:transformClassesWithDexForDebug'

Error:Execution failed for task ':app:transformClassesWithDexForDebug'

com.android.build.transform.api.TransformException

https://github.com/journeyapps/zxing-android-embedded/issues/110

I tried every solution, I tried to add .jar files one by one in my project, I used only those Google-services packages which are getting used in my project, I even added multidex jar.But nothing helps me

My Build.gradle file:

apply plugin: 'com.android.application'

android {
    compileSdkVersion 23
    buildToolsVersion "23.0.3"

    defaultConfig {
        applicationId "com.petzview.android"
        minSdkVersion 15
        targetSdkVersion 23
        versionCode 1
        versionName "1.0"
    }
    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
    }
    lintOptions {
        abortOnError false
        checkReleaseBuilds false
    }

    dexOptions {
        incremental = true;
        maxProcessCount 4
        javaMaxHeapSize "4g"
        dexInProcess = false
        preDexLibraries = false
    }
}

dependencies {
    compile fileTree(include: ['*.jar'], dir: 'libs')
    testCompile 'junit:junit:4.12'
    compile 'com.android.support:appcompat-v7:23.4.0'
    compile 'com.google.android.gms:play-services-ads:9.0.0'
    compile 'com.google.android.gms:play-services-plus:9.0.0'
    compile 'com.google.android.gms:play-services-gcm:9.0.0'
    compile project(':AVIOCtrlDefine')
    compile project(':Facebook')
    compile project(':SlidingMenu-master')
    compile 'com.android.support:multidex:1.0.1'
}
android.packagingOptions {
    exclude 'the META-INF / DEPENDENCIES'
    exclude 'META-INF/DEPENDENCIES.txt'
    exclude 'the META-INF / LICENSE'
    exclude 'the META-INF / LICENSE.txt'
    exclude 'the META-INF / license.txt'
    exclude 'the META-INF / NOTICE'
    exclude 'the META-INF / the NOTICE.txt '
    exclude ' the META-INF / NOTICE.txt '
    exclude ' the META-INF / ASL2.0 '
    exclude ' the META-INF / Services / javax.annotation.processing.Processor '
}
apply plugin: 'com.google.gms.google-services'

My main gradle file:

buildscript {
    repositories {
        jcenter()
    }
    dependencies {
       classpath 'com.android.tools.build:gradle:2.1.0'
       classpath 'com.google.gms:google-services:3.0.0'
    }
}

allprojects {
    repositories {
        jcenter()
    }
}

Screenshot of my libs folder:

MyApplication.java:

public class MyApplication extends MultiDexApplication {
    private Object mTempObject = null;

    private boolean flagHomeFragmentFirstCreate = true;

    @Override
    protected void attachBaseContext(Context base) {
        super.attachBaseContext(base);
        MultiDex.install(this);
        FacebookSdk.sdkInitialize(getApplicationContext());
    }

My Manifest class containing MyApplication:

 <application
        android:name=".MyApplication"
        android:allowBackup="true"
        android:icon="@drawable/ic_launcher"
        android:label="@string/app_name"
        android:largeHeap="true"
        android:theme="@style/AppTheme">

After running

./gradlew assembleDebug --stacktrace

Error Log

org.gradle.api.tasks.TaskExecutionException: Execution failed for task ':app:transformClassesWithDexForDebug'.
at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.executeActions(ExecuteActionsTaskExecuter.java:69)
at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.execute(ExecuteActionsTaskExecuter.java:46)
at org.gradle.api.internal.tasks.execution.PostExecutionAnalysisTaskExecuter.execute(PostExecutionAnalysisTaskExecuter.java:35)
at org.gradle.api.internal.tasks.execution.SkipUpToDateTaskExecuter.execute(SkipUpToDateTaskExecuter.java:64)
at org.gradle.api.internal.tasks.execution.ValidatingTaskExecuter.execute(ValidatingTaskExecuter.java:58)
at org.gradle.api.internal.tasks.execution.SkipEmptySourceFilesTaskExecuter.execute(SkipEmptySourceFilesTaskExecuter.java:52)
at org.gradle.api.internal.tasks.execution.SkipTaskWithNoActionsExecuter.execute(SkipTaskWithNoActionsExecuter.java:52)
at org.gradle.api.internal.tasks.execution.SkipOnlyIfTaskExecuter.execute(SkipOnlyIfTaskExecuter.java:53)
at org.gradle.api.internal.tasks.execution.ExecuteAtMostOnceTaskExecuter.execute(ExecuteAtMostOnceTaskExecuter.java:43)
at org.gradle.execution.taskgraph.DefaultTaskGraphExecuter$EventFiringTaskWorker.execute(DefaultTaskGraphExecuter.java:203)
at org.gradle.execution.taskgraph.DefaultTaskGraphExecuter$EventFiringTaskWorker.execute(DefaultTaskGraphExecuter.java:185)
at org.gradle.execution.taskgraph.AbstractTaskPlanExecutor$TaskExecutorWorker.processTask(AbstractTaskPlanExecutor.java:66)
at org.gradle.execution.taskgraph.AbstractTaskPlanExecutor$TaskExecutorWorker.run(AbstractTaskPlanExecutor.java:50)
at org.gradle.execution.taskgraph.DefaultTaskPlanExecutor.process(DefaultTaskPlanExecutor.java:25)
at org.gradle.execution.taskgraph.DefaultTaskGraphExecuter.execute(DefaultTaskGraphExecuter.java:110)
at org.gradle.execution.SelectedTaskExecutionAction.execute(SelectedTaskExecutionAction.java:37)
         org.gradle.execution.DefaultBuildExecuter.execute(DefaultBuildExecuter.java:37)
at org.gradle.execution.DefaultBuildExecuter.access$000(DefaultBuildExecuter.java:23)
at org.gradle.execution.DefaultBuildExecuter$1.proceed(DefaultBuildExecuter.java:43)
at org.gradle.execution.DryRunBuildExecutionAction.execute(DryRunBuildExecutionAction.java:32)
at org.gradle.execution.DefaultBuildExecuter.execute(DefaultBuildExecuter.java:37)
at org.gradle.execution.DefaultBuildExecuter.execute(DefaultBuildExecuter.java:30)
at org.gradle.initialization.DefaultGradleLauncher$4.run(DefaultGradleLauncher.java:154)
at org.gradle.internal.Factories$1.create(Factories.java:22)
at org.gradle.internal.progress.DefaultBuildOperationExecutor.run(DefaultBuildOperationExecutor.java:90)
at org.gradle.internal.progress.DefaultBuildOperationExecutor.run(DefaultBuildOperationExecutor.java:52)
at org.gradle.initialization.DefaultGradleLauncher.doBuildStages(DefaultGradleLauncher.java:151)
at org.gradle.initialization.DefaultGradleLauncher.access$200(DefaultGradleLauncher.java:32)
at org.gradle.initialization.DefaultGradleLauncher$1.create(DefaultGradleLauncher.java:99)
at org.gradle.initialization.DefaultGradleLauncher$1.create(DefaultGradleLauncher.java:93)
at org.gradle.internal.progress.DefaultBuildOperationExecutor.run(DefaultBuildOperationExecutor.java:90)
at org.gradle.internal.progress.DefaultBuildOperationExecutor.run(DefaultBuildOperationExecutor.java:62)
at org.gradle.initialization.DefaultGradleLauncher.doBuild(DefaultGradleLauncher.java:93)
at org.gradle.initialization.DefaultGradleLauncher.run(DefaultGradleLauncher.java:82)
at org.gradle.launcher.exec.InProcessBuildActionExecuter$DefaultBuildController.run(InProcessBuildActionExecuter.java:94)
at org.gradle.tooling.internal.provider.ExecuteBuildActionRunner.run(ExecuteBuildActionRunner.java:28)
at org.gradle.launcher.exec.ChainingBuildActionRunner.run(ChainingBuildActionRunner.java:35)
at org.gradle.launcher.exec.InProcessBuildActionExecuter.execute(InProcessBuildActionExecuter.java:43)
at org.gradle.launcher.exec.InProcessBuildActionExecuter.execute(InProcessBuildActionExecuter.java:28)
at org.gradle.launcher.exec.ContinuousBuildActionExecuter.execute(ContinuousBuildActionExecuter.java:78)
at org.gradle.launcher.exec.ContinuousBuildActionExecuter.execute(ContinuousBuildActionExecuter.java:48)
at org.gradle.launcher.exec.DaemonUsageSuggestingBuildActionExecuter.execute(DaemonUsageSuggestingBuildActionExecuter.java:51)
at org.gradle.launcher.exec.DaemonUsageSuggestingBuildActionExecuter.execute(DaemonUsageSuggestingBuildActionExecuter.java:28)
at org.gradle.launcher.cli.RunBuildAction.run(RunBuildAction.java:43)
at org.gradle.internal.Actions$RunnableActionAdapter.execute(Actions.java:170)
at org.gradle.launcher.cli.CommandLineActionFactory$ParseAndBuildAction.execute(CommandLineActionFactory.java:237)
at org.gradle.launcher.cli.CommandLineActionFactory$ParseAndBuildAction.execute(CommandLineActionFactory.java:210)
at org.gradle.launcher.cli.JavaRuntimeValidationAction.execute(JavaRuntimeValidationAction.java:35)
at org.gradle.launcher.cli.JavaRuntimeValidationAction.execute(JavaRuntimeValidationAction.java:24)
at org.gradle.launcher.cli.CommandLineActionFactory$WithLogging.execute(CommandLineActionFactory.java:206)
at org.gradle.launcher.cli.CommandLineActionFactory$WithLogging.execute(CommandLineActionFactory.java:169)
at org.gradle.launcher.cli.ExceptionReportingAction.execute(ExceptionReportingAction.java:33)
at org.gradle.launcher.cli.ExceptionReportingAction.execute(ExceptionReportingAction.java:22)
at org.gradle.launcher.Main.doAction(Main.java:33)
at org.gradle.launcher.bootstrap.EntryPoint.run(EntryPoint.java:45)
at org.gradle.launcher.bootstrap.ProcessBootstrap.runNoExit(ProcessBootstrap.java:54)
at org.gradle.launcher.bootstrap.ProcessBootstrap.run(ProcessBootstrap.java:35)
at org.gradle.launcher.GradleMain.main(GradleMain.java:23)
at org.gradle.wrapper.BootstrapMainStarter.start(BootstrapMainStarter.java:30)
at org.gradle.wrapper.WrapperExecutor.execute(WrapperExecutor.java:129)
at org.gradle.wrapper.GradleWrapperMain.main(GradleWrapperMain.java:61)
Caused by: java.lang.RuntimeException:
com.android.build.api.transform.TransformException:
com.android.ide.common.process.ProcessException:
java.util.concurrent.ExecutionException:
com.android.ide.common.process.ProcessException:
org.gradle.process.internal.ExecException: Process 'command
 '/opt/jdk/jdk1.8.0_45/bin/java'' finished with non-zero exit value 1
at com.android.builder.profile.Recorder$Block.handleException(Recorder.java:54)
at com.android.builder.profile.ThreadRecorder$1.record(ThreadRecorder.java:57)
at com.android.builder.profile.ThreadRecorder$1.record(ThreadRecorder.java:47)
at com.android.build.gradle.internal.pipeline.TransformTask.transform(TransformTask.java:173)
at org.gradle.internal.reflect.JavaMethod.invoke(JavaMethod.java:75)
at org.gradle.api.internal.project.taskfactory.AnnotationProcessingTaskFactory$IncrementalTaskAction.doExecute(AnnotationProcessingTaskFactory.java:244)
at org.gradle.api.internal.project.taskfactory.AnnotationProcessingTaskFactory$StandardTaskAction.execute(AnnotationProcessingTaskFactory.java:220)
at org.gradle.api.internal.project.taskfactory.AnnotationProcessingTaskFactory$IncrementalTaskAction.execute(AnnotationProcessingTaskFactory.java:231)
at org.gradle.api.internal.project.taskfactory.AnnotationProcessingTaskFactory$StandardTaskAction.execute(AnnotationProcessingTaskFactory.java:209)
at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.executeAction(ExecuteActionsTaskExecuter.java:80)
at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.executeActions(ExecuteActionsTaskExecuter.java:61)
         ... 60 more Caused by: com.android.build.api.transform.TransformException:> com.android.ide.common.process.ProcessException:
java.util.concurrent.ExecutionException:
com.android.ide.common.process.ProcessException:
org.gradle.process.internal.ExecException: Process 'command
 '/opt/jdk/jdk1.8.0_45/bin/java'' finished with non-zero exit value 1
at com.android.build.gradle.internal.transforms.DexTransform.transform(DexTransform.java:421)
at com.android.build.gradle.internal.pipeline.TransformTask$3.call(TransformTask.java:178)
at com.android.build.gradle.internal.pipeline.TransformTask$3.call(TransformTask.java:174)
at com.android.builder.profile.ThreadRecorder$1.record(ThreadRecorder.java:55)
         ... 69 more Caused by: com.android.ide.common.process.ProcessException:
java.util.concurrent.ExecutionException:
com.android.ide.common.process.ProcessException:
org.gradle.process.internal.ExecException: Process 'command
 '/opt/jdk/jdk1.8.0_45/bin/java'' finished with non-zero exit value 1
at com.android.builder.core.AndroidBuilder.dexOutOfProcess(AndroidBuilder.java:1553)
at com.android.builder.core.AndroidBuilder.runDexer(AndroidBuilder.java:1495)
at com.android.builder.core.AndroidBuilder.convertByteCode(AndroidBuilder.java:1482)
 at com.android.build.gradle.internal.transforms.DexTransform.transform(DexTransform.java:251)
         ... 72 more Caused by: java.util.concurrent.ExecutionException:
com.android.ide.common.process.ProcessException:
org.gradle.process.internal.ExecException: Process 'command
 '/opt/jdk/jdk1.8.0_45/bin/java'' finished with non-zero exit value 1
at com.android.builder.core.AndroidBuilder.dexOutOfProcess(AndroidBuilder.java:1549)
        ... 75 more Caused by: com.android.ide.common.process.ProcessException:
org.gradle.process.internal.ExecException: Process 'command
 '/opt/jdk/jdk1.8.0_45/bin/java'' finished with non-zero exit value 1
at com.android.build.gradle.internal.process.GradleProcessResult.assertNormalExitValue(GradleProcessResult.java:43)
at com.android.builder.core.AndroidBuilder$3.call(AndroidBuilder.java:1538)
at com.android.builder.core.AndroidBuilder$3.call(AndroidBuilder.java:1531)
Caused by: org.gradle.process.internal.ExecException: Process 'command
 '/opt/jdk/jdk1.8.0_45/bin/java'' finished with non-zero exit value 1
at org.gradle.process.internal.DefaultExecHandle$ExecResultImpl.assertNormalExitValue(DefaultExecHandle.java:367)
at com.android.build.gradle.internal.process.GradleProcessResult.assertNormalExitValue(GradleProcessResult.java:41)
         ... 2 more

Error while running application on device:

Error:trouble processing "java/awt/font/NumericShaper.class":
  Error:Ill-advised or mistaken usage of a core class (java.* or
  javax.*) Error:when not building a core library. Error:This is often
  due to inadvertently including a core library file Error:in your
  application's project, when using an IDE (such as Error:Eclipse). If
  you are sure you're not intentionally defining a Error:core class,
  then this is the most likely explanation of what's Error:going on.
  Error:However, you might actually be trying to define a class in a
  core Error:namespace, the source of which you may have taken, for
  example, Error:from a non-Android virtual machine project. This will
  most Error:assuredly not work. At a minimum, it jeopardizes the
  Error:compatibility of your app with future versions of the platform.
  Error:It is also often of questionable legality. Error:If you really
  intend to build a core library -- which is only Error:appropriate as
  part of creating a full virtual machine Error:distribution, as opposed
  to compiling an application -- then use Error:the "--core-library"
  option to suppress this error message. Error:If you go ahead and use
  "--core-library" but are in fact Error:building an application, then
  be forewarned that your application Error:will still fail to build or
  run, at some point. Please be Error:prepared for angry customers who
  find, for example, that your Error:application ceases to function once
  they upgrade their operating Error:system. You will be to blame for
  this problem. Error:If you are legitimately using some code that
  happens to be in a Error:core package, then the easiest safe
  alternative you have is to Error:repackage that code. That is, move
  the classes in question into Error:your own package namespace. This
  means that they will never be in Error:conflict with core system
  classes. JarJar is a tool that may help Error:you in this endeavor. If
  you find that you cannot do this, then Error:that is an indication
  that the path you are on will ultimately Error:lead to pain,
  suffering, grief, and lamentation. Error:1 error; aborting
  Error:Execution failed for task
  ':app:transformClassesWithDexForDebug'.

com.android.build.api.transform.TransformException: com.android.ide.common.process.ProcessException:
    java.util.concurrent.ExecutionException:
    com.android.ide.common.process.ProcessException:
    org.gradle.process.internal.ExecException: Process 'command
    '/usr/lib/jvm/java-8-oracle/bin/java'' finished with non-zero exit
    value 1 Information:BUILD FAILED

Where am I going wrong?


问:
MySql view shows wrong information from the database in jpa query
I have a view from mysql mapped by hibernate in a java project, when I first map the entity and consult the information, it gives the information I have in my DB, but when I insert new data into the tables my view is refering to, it repeats the first row again and again(in the view, the information on the tables is ok), as if I was inserting the same information in the view. However, in my DB the insert is ok, the view works and shows the correct information, therefore the only problem is the mapped view. I would like to know, if there is some way to fix the view problem.

This is the view mapped as an Entity

```<code>@Entity
public class Vistapendientes {
    private int aluId;
    private String aluNom;
    private String herNom;
    private Date soliFechaSalida;
    private Date soliFechaDevuelve;
...
</code>```

This is the information I get from the view in my DB

select * from vistapendientes;

```<code>17380010    Oscar   Pinzas punta 1  2019-05-18  2019-05-22
17380009    Ivonne  Pinzas punta 2  2019-05-14  2019-05-26
17380010    Oscar   Martillo 1  2019-05-21  2019-05-23
</code>```

The query I use in the program is:

jpa-ql> select v from Vistapendientes v

And this is the info I get from that query

```<code>17380010    Oscar   Pinzas punta 1  2019-05-18  2019-05-22
17380009    Ivonne  Pinzas punta 2  2019-05-14  2019-05-26
17380010    Oscar   Pinzas punta 1  2019-05-18  2019-05-22
</code>```

As you can see, the first row repeats itself, instead of showing me the actual information in my DB.

Of course, I expect to get the same result I get from my DB in the JPA-QL query I do in the program.
Thanks for reading.

答: The only way I could solve this was building the view directly in the program, through hibernate's 'mappedBy' property.</p>

Body:
I have a view from mysql mapped by hibernate in a java project, when I first map the entity and consult the information, it gives the information I have in my DB, but when I insert new data into the tables my view is refering to, it repeats the first row again and again(in the view, the information on the tables is ok), as if I was inserting the same information in the view. However, in my DB the insert is ok, the view works and shows the correct information, therefore the only problem is the mapped view. I would like to know, if there is some way to fix the view problem.

This is the view mapped as an Entity

@Entity
public class Vistapendientes {
    private int aluId;
    private String aluNom;
    private String herNom;
    private Date soliFechaSalida;
    private Date soliFechaDevuelve;
...

This is the information I get from the view in my DB

select * from vistapendientes;

17380010    Oscar   Pinzas punta 1  2019-05-18  2019-05-22
17380009    Ivonne  Pinzas punta 2  2019-05-14  2019-05-26
17380010    Oscar   Martillo 1  2019-05-21  2019-05-23

The query I use in the program is:

jpa-ql> select v from Vistapendientes v

And this is the info I get from that query

17380010    Oscar   Pinzas punta 1  2019-05-18  2019-05-22
17380009    Ivonne  Pinzas punta 2  2019-05-14  2019-05-26
17380010    Oscar   Pinzas punta 1  2019-05-18  2019-05-22

As you can see, the first row repeats itself, instead of showing me the actual information in my DB.

Of course, I expect to get the same result I get from my DB in the JPA-QL query I do in the program.
Thanks for reading.


问:
Web page doesn´t update automatically when uploading new content
I´m creating a static web page with HTML and CSS, the problem comes when I upload new info into the server. When I try to reload the page nothing changes. It only changes when I make a ctrl f5 reload. Is there a way to make the site to reload itself so the user can see the newest info every time they enter the web site?

I tried using a "?" sing ager calling the CSS file but it's not working

```<code>link href="CSS/styles.css?v=1.1" rel="stylesheet"

</code>```

答:
Static content is cached by the browser. If the server sends a max-age then the browser will not attempt to get a new version unless the cache is expired as per the max age.

However ctrl-F5 forces a refresh disregarding the aging parameters.

You can try setting a shorter max-age on the server, but that will cause more load as the clients will fetch resources more frequently.

Body:
I´m creating a static web page with HTML and CSS, the problem comes when I upload new info into the server. When I try to reload the page nothing changes. It only changes when I make a ctrl f5 reload. Is there a way to make the site to reload itself so the user can see the newest info every time they enter the web site?

I tried using a "?" sing ager calling the CSS file but it's not working

link href="CSS/styles.css?v=1.1" rel="stylesheet"


问:
Why does Thread.Sleep(0) fix my problems, and how to avoid it?
I'm working on a client server application.  At certain times, on certain machines, when there's more than 5 clients requesting data, it seems to reach a deadlock.  If I step in to debug the problem, then the program appears to be processing.  Simply setting a break point where I know the program is executing, and causing it to hit the breakpoint a few times causes it to finish. If I insert Thread.Sleep(0) at certain points in the code, mostly around some cpu intensive loops, it seems to pretty much totally resolve the problem.  The one problem that I have now is that if I call Thread.Sleep(0) too much, it can slow down the code.  If I don't call it enough, the code seems to be in deadlock.  Although I can verify that it isn't in deadlock because if I step into the code, it causes the problem to disappear, simply because I'm pausing a thread.

Is there a good way to track down exactly what is causing this.  It seems that it only happens on my laptop which is running Vista, but not on my desktop which is running Windows XP.  However, it's impossible to debug, because simply stepping into the code causes the problem to go away.  I've read comments that calling Thread.Sleep(0) is a bad practice, and shouldn't be necessary, and I don't like putting witchcraft type code into my applications that I don't understand why it has to be there.  Any pointers would be greatly appreciated.

[EDIT]
I can also verify that the code is still running when it is "deadlocked" because if I leave it long enough, it will finish, only the amount of time it takes is many orders of magnitude higher.  I mean like it's actually at least 100 times slower when it's in this "deadlocked" mode.  The CPU is pegged at 80-95%, so it is working, altough what it is doing is beyond me, because it's taking forever to complete the task.

[More Info]
Just because everybody here is insistent that it's a deadlock, I removed all the code that did any locking. There was only a couple lines of code that did any locking whatsoever. The threads work completely independantly for the most part, so it wasn't much work to remove the locking completely.  Still the problem persists.  There is no more synclocks in my code, no more mutex's no more stuff that I see see that would cause a deadlock, but the problem is still there.  And it's not deadlocked.  It runs, albeit very slowly, even though it's eating up all the processor resources.

答:
Maybe try using a tool like Typemock Racer?

Disclaimer: I've never used that tool before.

OwnerDisplayName: Kibbee

ContentLicense: CC BY-SA 2.5

LastEditorDisplayName: Kibbee

OwnerDisplayName: FryGuy


问:
Zero an array in C code

Possible Duplicates:

  How to initialize an array to something in C without a loop?

  How to initialize an array in C

How can I zero a known size of an array without using a for or any other loop ?

For example:

```<code>arr[20] = 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0;
</code>```

This is the long way... I need it the short way.

答:
Note: You can use memset with any character.

Example:

```<code>int arr[20];
memset(arr, 'A', sizeof(arr));
</code>```

Also could be partially filled

```<code>int arr[20];
memset(&arr[5], 0, 10);
</code>```

But be carefull. It is not limited for the array size, you could easily cause severe damage to your program doing something like this:

```<code>int arr[20];
memset(arr, 0, 200);
</code>```

It is going to work (under windows) and zero memory after your array. It might cause damage to other variables values.

ContentLicense: CC BY-SA 3.0

Title: Zero an array in C code

Body:
Possible Duplicates:

  How to initialize an array to something in C without a loop?

  How to initialize an array in C

How can I zero a known size of an array without using a for or any other loop ?

For example:

arr[20] = 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0;

This is the long way... I need it the short way.

Body:
Note: You can use memset with any character.

Example:

int arr[20];
memset(arr, 'A', sizeof(arr));

Also could be partially filled

int arr[20];
memset(&arr[5], 0, 10);

But be carefull. It is not limited for the array size, you could easily cause severe damage to your program doing something like this:

int arr[20];
memset(arr, 0, 200);

It is going to work (under windows) and zero memory after your array. It might cause damage to other variables values.


问:
Swift 4: validating credit card expiration date
I am writing code to check whether the credit card has expired or not.

Here is what I have

```<code>let dateFormatter = DateFormatter()
dateFormatter.dateFormat = "MM/yyyy"
let enteredDate = dateFormatter.date(from: expiryDate.text!) /* line 3 - set to first day of month */
let now = Date()
if (enteredDate! < now) {
    //expired
    // does not work if current month and year
    // is the same as the expiration date,
    // because expiration day is set to the first day of the month on line 3
} else {
    // valid
    print("valid - now: \(now) entered: \(enteredDate)")
}
</code>```

Any ideas on how I can change the initialized date to be the last day of the month instead of the first day?

答:
enteredDate will be midnight local time on the first of the month of the expiry date. Since you want that whole month to be valid, add 1 month to that value and then compare Date() to that updated value.

```<code>let dateFormatter = DateFormatter()
dateFormatter.dateFormat = "MM/yyyy"
let enteredDate = dateFormatter.date(from: expiryDate.text!)!
let endOfMonth = Calendar.current.date(byAdding: .month, value: 1, to: enteredDate)!
let now = Date()
if (endOfMonth < now) {
    print("Expired - \(enteredDate) - \(endOfMonth)")
} else {
    // valid
    print("valid - now: \(now) entered: \(enteredDate)")
}
</code>```

Please note that I left proper handling of optionals as an exercise for the reader.

Body:
I am writing code to check whether the credit card has expired or not.

Here is what I have

let dateFormatter = DateFormatter()
dateFormatter.dateFormat = "MM/yyyy"
let enteredDate = dateFormatter.date(from: expiryDate.text!) /* line 3 - set to first day of month */
let now = Date()
if (enteredDate! < now) {
    //expired
    // does not work if current month and year
    // is the same as the expiration date,
    // because expiration day is set to the first day of the month on line 3
} else {
    // valid
    print("valid - now: \(now) entered: \(enteredDate)")
}

Any ideas on how I can change the initialized date to be the last day of the month instead of the first day?

Body:
enteredDate will be midnight local time on the first of the month of the expiry date. Since you want that whole month to be valid, add 1 month to that value and then compare Date() to that updated value.

let dateFormatter = DateFormatter()
dateFormatter.dateFormat = "MM/yyyy"
let enteredDate = dateFormatter.date(from: expiryDate.text!)!
let endOfMonth = Calendar.current.date(byAdding: .month, value: 1, to: enteredDate)!
let now = Date()
if (endOfMonth < now) {
    print("Expired - \(enteredDate) - \(endOfMonth)")
} else {
    // valid
    print("valid - now: \(now) entered: \(enteredDate)")
}

Please note that I left proper handling of optionals as an exercise for the reader.


问:
How to add image/icon for right side of a button?
These days I am developing flutter mobile application for the Android platform. I want to add a button with text an icon/image. That image must be the right side of the button text.

I have already attached the image here.

This is my code.

```<code>child: FlatButton.icon(
     icon: Image.asset("images/notesicon.png", width: 20.0,height: 20.0,),
     label: Text("Add Note",
        style: TextStyle(
           fontSize: 11.0,
           fontFamily: "Raleway"
        ),
     ),
     textColor: Colors.white,
     color: Color(0xFF226597),
     shape: OutlineInputBorder(borderSide: BorderSide(
               style: BorderStyle.solid,
               width: 1.0,
               color: Colors.black),
            borderRadius: new BorderRadius.circular(20.0)
      ),
    ),
</code>```

答:
Try below code:</p>

```<code>FlatButton(
   padding: EdgeInsets.all(10.0),
   child: Row(
   children: < Widget > [
     Text("Make a Note"),
     Icon(Icons.note),
   ],
 ),
)
</code>```

Body:
These days I am developing flutter mobile application for the Android platform. I want to add a button with text an icon/image. That image must be the right side of the button text.

I have already attached the image here.

This is my code.

child: FlatButton.icon(
     icon: Image.asset("images/notesicon.png", width: 20.0,height: 20.0,),
     label: Text("Add Note",
        style: TextStyle(
           fontSize: 11.0,
           fontFamily: "Raleway"
        ),
     ),
     textColor: Colors.white,
     color: Color(0xFF226597),
     shape: OutlineInputBorder(borderSide: BorderSide(
               style: BorderStyle.solid,
               width: 1.0,
               color: Colors.black),
            borderRadius: new BorderRadius.circular(20.0)
      ),
    ),

Body:
Try below code:

FlatButton(
   padding: EdgeInsets.all(10.0),
   child: Row(
   children: < Widget > [
     Text("Make a Note"),
     Icon(Icons.note),
   ],
 ),
)


问:
How can I code a Javascript Alert to only populate once per web session?
I am creating a website for my final and have coded an "adult content" alert on my homepage. I am trying to get the site to populate that message only once per session but right now it populates every time you go to the homepage.

The class is HTML and CSS but we were asked to include one basic javascript code and the "alert" seemed most appropriate. I have tried googling this question different ways to get help but it's mostly providing information that is above a very very basic level of javascript.

This is my current code:

```<code><script>
alert("WARNING! Adult Language and Content! The following is intended for
immature adults only. Viewer Discretion is Advised.")
</script>
</code>```

This is the site:
http://mysite.du.edu/~mdarienz/index.html

Since this is for a final, I don't need the code to fix it but if you could maybe steer me in the right direction for how to approach it I would greatly appreciate it.

答:
sessionStorage is all you need. Just add this in your script.</p>

```<code><script>
    if(sessionStorage.getItem('showAlert') != "false"){
        alert("WARNING! Adult Language and Content! The following is intended for
immature adults only. Viewer Discretion is Advised.");
        sessionStorage.setItem('showAlert', "false");
    }
</script>
</code>```

Body:
I am creating a website for my final and have coded an "adult content" alert on my homepage. I am trying to get the site to populate that message only once per session but right now it populates every time you go to the homepage.

The class is HTML and CSS but we were asked to include one basic javascript code and the "alert" seemed most appropriate. I have tried googling this question different ways to get help but it's mostly providing information that is above a very very basic level of javascript.

This is my current code:

This is the site:
http://mysite.du.edu/~mdarienz/index.html

Since this is for a final, I don't need the code to fix it but if you could maybe steer me in the right direction for how to approach it I would greatly appreciate it.

Body:
sessionStorage is all you need. Just add this in your script.

<script>
    if(sessionStorage.getItem('showAlert') != "false"){
        alert("WARNING! Adult Language and Content! The following is intended for
immature adults only. Viewer Discretion is Advised.");
        sessionStorage.setItem('showAlert', "false");
    }
</script>