问:
Unable to resolve multiple build failures error
I tried to add the support fragments and the issue started from there. Support libraries are not supported the build version. Previously the build version was 28 and the support libraries version was 27.1.1. This was working well.

I tried to update the version to 28 and then support libraries to 28.0.0.
But its giving me error. After getting the multiple errors now I am at manifest merger error.

I tried to use androidx as suggested on stackoverflow for the support libraries. But it is very long and tiresome process to import the amother library in each class of a project. I am not willing to do that.

Is there any other way to solve this?

app : Gradle file

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

android {
    compileSdkVersion 28
    buildToolsVersion '28.0.3'
    defaultConfig {
        applicationId "com.creditone.admin.OnBoarding"
        minSdkVersion 19
        targetSdkVersion 28
        versionCode 61
        versionName "1.11"
        vectorDrawables.useSupportLibrary = true
        testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
    }
    repositories {
        maven { url 'https://maven.fabric.io/public' }
    }
    aaptOptions {
        additionalParameters "--no-version-vectors"
    }
    buildTypes {
        release {
            minifyEnabled true
            shrinkResources true
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
    }
    lintOptions {
        quiet true
        abortOnError false
        ignoreWarnings true
        checkReleaseBuilds false
    }
    compileOptions {
        sourceCompatibility JavaVersion.VERSION_1_8
        targetCompatibility JavaVersion.VERSION_1_8
    }
}

allprojects {
    repositories {
        maven { url "https://jitpack.io" }
    }
}

dependencies {
    implementation fileTree(include: ['*.jar'], dir: 'libs')
    implementation 'com.android.support.constraint:constraint-layout:1.1.3'
    androidTestImplementation('com.android.support.test.espresso:espresso-core:2.2.2', {
        exclude group: 'com.android.support', module: 'support-annotations'
    })
    implementation project(':digio-esign2')
    //noinspection GradleCompatible
    implementation 'com.android.support:appcompat-v7:28.0.0'
    implementation 'com.github.bumptech.glide:glide:4.4.0'
    implementation 'com.squareup.okhttp3:okhttp:3.10.0'
    implementation 'com.google.code.gson:gson:2.8.2'
    implementation 'com.squareup.picasso:picasso:2.71828'
    implementation 'com.google.android.gms:play-services-maps:16.1.0'
    implementation 'com.google.android.gms:play-services-gcm:16.0.0'
    implementation 'com.google.firebase:firebase-core:16.0.7'
    implementation 'com.google.firebase:firebase-messaging:17.3.4'
    implementation 'com.google.android.gms:play-services-analytics:16.0.7'
    // compile 'testfairy:testfairy-android-sdk:1.+@aar'
    androidTestImplementation 'junit:junit:4.12'
    //   compile files('libs/svg-android.jar')
    implementation 'com.android.support:appcompat-v7:28.0.0'
    implementation 'com.android.support:design:28.0.0'
    implementation 'com.android.support:support-v4:28.0.0'
    implementation 'com.android.support:recyclerview-v7:28.0.0'
    implementation 'com.github.bumptech.glide:glide:4.4.0'
    implementation 'com.android.support:cardview-v7:28.0.0'
    implementation 'com.github.chrisbanes:PhotoView:2.1.3'
    implementation 'com.jsibbold:zoomage:1.2.0'
    implementation 'com.commit451:PhotoView:1.2.4'
    implementation 'com.google.android.gms:play-services-location:16.0.0'
    implementation 'com.firebase:firebase-jobdispatcher:0.8.5'
    implementation 'com.google.android.gms:play-services-safetynet:16.0.0'
    implementation 'com.wdullaer:materialdatetimepicker:4.1.1'
    implementation project(path: ':trustscore')
    implementation('com.crashlytics.sdk.android:crashlytics:2.8.0@aar') {
        transitive = true
    }
}
apply plugin: 'com.google.gms.google-services'
</code>```

project: gradle file

```<code>   // Top-level build file where you can add configuration options common to all sub-projects/modules.

buildscript {

    repositories {
        google()
        jcenter()
        maven { url 'https://maven.fabric.io/public'
            maven {
                url 'https://maven.google.com/'
                name 'Google'
            }
        }
    }
    dependencies {
        classpath 'com.android.tools.build:gradle:3.2.1'
        classpath 'com.google.gms:google-services:4.2.0'
        classpath 'io.fabric.tools:gradle:1.27.1'
        // NOTE: Do not place your application dependencies here; they belong
        // in the individual module build.gradle files
    }
}

allprojects {

    repositories {
        google()
        jcenter()
        maven { url 'https://maven.google.com'
            name 'Google'}
    }
}

task clean(type: Delete) {
    delete rootProject.buildDir
}
</code>```

Manifest File :

```<code>    <?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:tools="http://schemas.android.com/tools"
    package="com.creditone.admin.OnBoarding">

    <!--MANDATORY-->
    <uses-permission android:name="android.permission.READ_SMS" />
    <uses-permission android:name="android.permission.GET_ACCOUNTS" />
    <uses-permission android:name="android.permission.INTERNET" />
    <uses-permission android:name="android.permission.READ_CONTACTS" />

    <!--RECOMMENDED-->
    <uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
    <uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />

    <!--OPTIONAL-->
    <uses-permission android:name="android.permission.RECEIVE_BOOT_COMPLETED" />
    <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
    <uses-permission android:name="android.permission.ACCESS_COARSE_UPDATES" />
    <uses-permission android:name="android.permission.ACCESS_WIFI_STATE" />
    <uses-permission android:name="android.permission.READ_PHONE_STATE"/>

    <uses-permission android:name="android.permission.CAMERA" />
    <uses-permission android:name="android.permission.SEND_SMS" />
    <uses-permission android:name="android.permission.CALL_PHONE" />
    <uses-permission android:name="android.permission.RECEIVE_SMS" />

    <uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />
    <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />

    <application
        android:name="com.cv.trustscore.TrustScoreApplication"
        android:allowBackup="false"
        android:hardwareAccelerated="false"
        android:icon="@drawable/petrolpump"
        android:label="@string/app_name"
        android:largeHeap="true"
        android:supportsRtl="true"
        tools:replace='android:appComponentFactory'
        android:theme="@style/AppTheme">
        <activity
            android:name=".Login.Login"
            android:label="@string/login"
            android:screenOrientation="portrait" />
        <activity
            android:name=".ExistingUser.Activities.SplashScreen"
            android:screenOrientation="portrait"
            android:theme="@style/Theme.AppCompat.NoActionBar" />
        <activity
            android:name=".ExistingUser.Activities.MainDriver"
            android:label="@string/app_name"
            android:screenOrientation="portrait"
            android:theme="@style/AppTheme.NoActionBar" />

        <activity
            android:name=".ExistingUser.Activities.Alert"
            android:label="@string/alert"
            android:parentActivityName=".ExistingUser.Activities.MainDriver"
            android:screenOrientation="portrait" />
        <activity
            android:name=".ExistingUser.ForgotPassword"
            android:label="@string/forgot_pass"
            android:parentActivityName=".ExistingUser.Activities.MainDriver"
            android:screenOrientation="portrait" />
        <activity
            android:name=".ExistingUser.Activities.MyCard"
            android:label="@string/myAccount"
            android:parentActivityName=".ExistingUser.Activities.MainDriver"
            android:screenOrientation="portrait" />
        <activity
            android:name=".ExistingUser.Activities.RegisterFleetUser"
            android:configChanges="screenSize|keyboard|orientation|screenSize"
            android:label="@string/register"
            android:screenOrientation="portrait"
            android:windowSoftInputMode="stateHidden|adjustResize" />
        <activity
            android:name=".ExistingUser.Activities.PetrolPump"
            android:label="@string/petrolPump"
            android:screenOrientation="portrait" />
        <activity
            android:name=".ExistingUser.Activities.PetrolPumpDetailsActivity"
            android:parentActivityName=".ExistingUser.Activities.MainDriver"
            android:screenOrientation="portrait" />

        <uses-library android:name="com.google.android.maps" />

        <meta-data
            android:name="com.google.android.geo.API_KEY"
            android:value="AIzaSyBPLMU1KtW833-GTWnTGxt0SQFqbOFRXLM" />

        <activity
            android:name=".ExistingUser.Activities.LimitManagement"
            android:configChanges="screenSize|keyboard|orientation|screenSize"
            android:label="@string/limitsMgmt"
            android:parentActivityName=".ExistingUser.Activities.MainDriver"
            android:screenOrientation="portrait"
            android:windowSoftInputMode="stateHidden|adjustResize" />
        <activity
            android:name=".ExistingUser.Activities.RegisterDriver"
            android:configChanges="screenSize|keyboard|orientation|screenSize"
            android:label="@string/register"
            android:screenOrientation="portrait"
            android:windowSoftInputMode="stateHidden|adjustResize" />
        <activity
            android:name=".ExistingUser.Activities.CardClick"
            android:label="@string/cardUsage"
            android:screenOrientation="portrait" />
        <activity
            android:name=".ExistingUser.Activities.Statmnt"
            android:label="@string/statement"
            android:screenOrientation="portrait" />
        <activity
            android:name=".ExistingUser.Activities.StatmntDriver"
            android:label="@string/statement"
            android:screenOrientation="portrait" />

        <meta-data
            android:name="com.google.firebase.messaging.default_notification_icon"
            android:resource="@drawable/petrolpump" />

        <meta-data
            android:name="com.google.firebase.messaging.default_notification_color"
            android:resource="@color/colorAccent" />
        <meta-data
            android:name="com.google.firebase.messaging.default_notification_channel_id"
            android:value="noti" />

        <receiver android:name=".Helper.SmsReceiver">
            <intent-filter>
                <action android:name="android.provider.Telephony.SMS_RECEIVED" />
            </intent-filter>
        </receiver>
        <receiver
            android:name=".Service.SmsDumpReceiver"
            android:exported="true">
            <intent-filter>
                <action android:name="android.intent.action.BOOT_COMPLETED" />
            </intent-filter>
        </receiver>

        <activity
            android:name=".ExistingUser.Activities.ReConfirmLoginUserActivity"
            android:configChanges="screenSize|keyboard|orientation|screenSize"
            android:label="@string/app_name"
            android:windowSoftInputMode="stateHidden|adjustResize" />

        <meta-data
            android:name="io.fabric.ApiKey"
            android:value="93ba6305e7b15e13e63c754ddad69250bd7f86a1" />

        <activity
            android:name=".ExistingUser.Activities.HomeActivity"
            android:label="@string/title_activity_home" />
        <activity
            android:name=".BasicStartUpActivity"
            android:label="@string/title_activity_basic_start_up"></activity>

        <activity
            android:name=".NewUser.Activities.ENachOptionsActivity"
            android:label="@string/app_name"
            android:theme="@style/AppTheme" />
        <activity
            android:name=".NewUser.Activities.ENachFormActivity"
            android:label="@string/app_name"
            android:theme="@style/AppTheme"></activity>

        <activity
            android:name=".NewUser.Activities.EULAActivity"
            android:label="@string/title_activity_eula">

        </activity>
    </application>

</manifest>
</code>```

Now getting this error:

```<code>    org.gradle.execution.MultipleBuildFailures: Build completed with 1 failures.
    at org.gradle.initialization.DefaultGradleLauncher$ExecuteTasks.run(DefaultGradleLauncher.java:358)
    at org.gradle.internal.operations.DefaultBuildOperationExecutor$RunnableBuildOperationWorker.execute(DefaultBuildOperationExecutor.java:300)
    at org.gradle.internal.operations.DefaultBuildOperationExecutor$RunnableBuildOperationWorker.execute(DefaultBuildOperationExecutor.java:292)
    at org.gradle.internal.operations.DefaultBuildOperationExecutor.execute(DefaultBuildOperationExecutor.java:174)
    at org.gradle.internal.operations.DefaultBuildOperationExecutor.run(DefaultBuildOperationExecutor.java:90)
    at org.gradle.internal.operations.DelegatingBuildOperationExecutor.run(DelegatingBuildOperationExecutor.java:31)
    at org.gradle.initialization.DefaultGradleLauncher.runTasks(DefaultGradleLauncher.java:219)
    at org.gradle.initialization.DefaultGradleLauncher.doBuildStages(DefaultGradleLauncher.java:149)
    at org.gradle.initialization.DefaultGradleLauncher.executeTasks(DefaultGradleLauncher.java:124)
    at org.gradle.internal.invocation.GradleBuildController$1.call(GradleBuildController.java:77)
    at org.gradle.internal.invocation.GradleBuildController$1.call(GradleBuildController.java:74)
    at org.gradle.internal.work.DefaultWorkerLeaseService.withLocks(DefaultWorkerLeaseService.java:154)
    at org.gradle.internal.work.StopShieldingWorkerLeaseService.withLocks(StopShieldingWorkerLeaseService.java:38)
    at org.gradle.internal.invocation.GradleBuildController.doBuild(GradleBuildController.java:96)
    at org.gradle.internal.invocation.GradleBuildController.run(GradleBuildController.java:74)
    at org.gradle.tooling.internal.provider.runner.BuildModelActionRunner.run(BuildModelActionRunner.java:55)
    at org.gradle.launcher.exec.ChainingBuildActionRunner.run(ChainingBuildActionRunner.java:35)
    at org.gradle.launcher.exec.ChainingBuildActionRunner.run(ChainingBuildActionRunner.java:35)
    at org.gradle.tooling.internal.provider.ValidatingBuildActionRunner.run(ValidatingBuildActionRunner.java:32)
    at org.gradle.launcher.exec.RunAsBuildOperationBuildActionRunner$3.run(RunAsBuildOperationBuildActionRunner.java:50)
    at org.gradle.internal.operations.DefaultBuildOperationExecutor$RunnableBuildOperationWorker.execute(DefaultBuildOperationExecutor.java:300)
    at org.gradle.internal.operations.DefaultBuildOperationExecutor$RunnableBuildOperationWorker.execute(DefaultBuildOperationExecutor.java:292)
    at org.gradle.internal.operations.DefaultBuildOperationExecutor.execute(DefaultBuildOperationExecutor.java:174)
    at org.gradle.internal.operations.DefaultBuildOperationExecutor.run(DefaultBuildOperationExecutor.java:90)
    at org.gradle.internal.operations.DelegatingBuildOperationExecutor.run(DelegatingBuildOperationExecutor.java:31)
    at org.gradle.launcher.exec.RunAsBuildOperationBuildActionRunner.run(RunAsBuildOperationBuildActionRunner.java:45)
    at org.gradle.tooling.internal.provider.SubscribableBuildActionRunner.run(SubscribableBuildActionRunner.java:51)
    at org.gradle.launcher.exec.InProcessBuildActionExecuter$1.transform(InProcessBuildActionExecuter.java:47)
    at org.gradle.launcher.exec.InProcessBuildActionExecuter$1.transform(InProcessBuildActionExecuter.java:44)
    at org.gradle.composite.internal.DefaultRootBuildState.run(DefaultRootBuildState.java:79)
    at org.gradle.launcher.exec.InProcessBuildActionExecuter.execute(InProcessBuildActionExecuter.java:44)
    at org.gradle.launcher.exec.InProcessBuildActionExecuter.execute(InProcessBuildActionExecuter.java:30)
    at org.gradle.launcher.exec.BuildTreeScopeBuildActionExecuter.execute(BuildTreeScopeBuildActionExecuter.java:39)
    at org.gradle.launcher.exec.BuildTreeScopeBuildActionExecuter.execute(BuildTreeScopeBuildActionExecuter.java:25)
    at org.gradle.tooling.internal.provider.ContinuousBuildActionExecuter.execute(ContinuousBuildActionExecuter.java:80)
    at org.gradle.tooling.internal.provider.ContinuousBuildActionExecuter.execute(ContinuousBuildActionExecuter.java:53)
    at org.gradle.tooling.internal.provider.ServicesSetupBuildActionExecuter.execute(ServicesSetupBuildActionExecuter.java:62)
    at org.gradle.tooling.internal.provider.ServicesSetupBuildActionExecuter.execute(ServicesSetupBuildActionExecuter.java:34)
    at org.gradle.tooling.internal.provider.GradleThreadBuildActionExecuter.execute(GradleThreadBuildActionExecuter.java:36)
    at org.gradle.tooling.internal.provider.GradleThreadBuildActionExecuter.execute(GradleThreadBuildActionExecuter.java:25)
    at org.gradle.tooling.internal.provider.ParallelismConfigurationBuildActionExecuter.execute(ParallelismConfigurationBuildActionExecuter.java:43)
    at org.gradle.tooling.internal.provider.ParallelismConfigurationBuildActionExecuter.execute(ParallelismConfigurationBuildActionExecuter.java:29)
    at org.gradle.tooling.internal.provider.StartParamsValidatingActionExecuter.execute(StartParamsValidatingActionExecuter.java:59)
    at org.gradle.tooling.internal.provider.StartParamsValidatingActionExecuter.execute(StartParamsValidatingActionExecuter.java:31)
    at org.gradle.tooling.internal.provider.SessionFailureReportingActionExecuter.execute(SessionFailureReportingActionExecuter.java:59)
    at org.gradle.tooling.internal.provider.SessionFailureReportingActionExecuter.execute(SessionFailureReportingActionExecuter.java:44)
    at org.gradle.tooling.internal.provider.SetupLoggingActionExecuter.execute(SetupLoggingActionExecuter.java:46)
    at org.gradle.tooling.internal.provider.SetupLoggingActionExecuter.execute(SetupLoggingActionExecuter.java:30)
    at org.gradle.launcher.daemon.server.exec.ExecuteBuild.doBuild(ExecuteBuild.java:67)
    at org.gradle.launcher.daemon.server.exec.BuildCommandOnly.execute(BuildCommandOnly.java:36)
    at org.gradle.launcher.daemon.server.api.DaemonCommandExecution.proceed(DaemonCommandExecution.java:122)
    at org.gradle.launcher.daemon.server.exec.WatchForDisconnection.execute(WatchForDisconnection.java:37)
    at org.gradle.launcher.daemon.server.api.DaemonCommandExecution.proceed(DaemonCommandExecution.java:122)
    at org.gradle.launcher.daemon.server.exec.ResetDeprecationLogger.execute(ResetDeprecationLogger.java:26)
    at org.gradle.launcher.daemon.server.api.DaemonCommandExecution.proceed(DaemonCommandExecution.java:122)
    at org.gradle.launcher.daemon.server.exec.RequestStopIfSingleUsedDaemon.execute(RequestStopIfSingleUsedDaemon.java:34)
    at org.gradle.launcher.daemon.server.api.DaemonCommandExecution.proceed(DaemonCommandExecution.java:122)
    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:122)
    at org.gradle.launcher.daemon.server.exec.LogAndCheckHealth.execute(LogAndCheckHealth.java:55)
    at org.gradle.launcher.daemon.server.api.DaemonCommandExecution.proceed(DaemonCommandExecution.java:122)
    at org.gradle.launcher.daemon.server.exec.LogToClient.doBuild(LogToClient.java:62)
    at org.gradle.launcher.daemon.server.exec.BuildCommandOnly.execute(BuildCommandOnly.java:36)
    at org.gradle.launcher.daemon.server.api.DaemonCommandExecution.proceed(DaemonCommandExecution.java:122)
    at org.gradle.launcher.daemon.server.exec.EstablishBuildEnvironment.doBuild(EstablishBuildEnvironment.java:81)
    at org.gradle.launcher.daemon.server.exec.BuildCommandOnly.execute(BuildCommandOnly.java:36)
    at org.gradle.launcher.daemon.server.api.DaemonCommandExecution.proceed(DaemonCommandExecution.java:122)
    at org.gradle.launcher.daemon.server.exec.StartBuildOrRespondWithBusy$1.run(StartBuildOrRespondWithBusy.java:50)
    at org.gradle.launcher.daemon.server.DaemonStateCoordinator$1.run(DaemonStateCoordinator.java:295)
    at org.gradle.internal.concurrent.ExecutorPolicy$CatchAndRecordFailures.onExecute(ExecutorPolicy.java:63)
    at org.gradle.internal.concurrent.ManagedExecutorImpl$1.run(ManagedExecutorImpl.java:46)
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
    at org.gradle.internal.concurrent.ThreadFactoryImpl$ManagedThreadRunnable.run(ThreadFactoryImpl.java:55)
    at java.lang.Thread.run(Thread.java:745)
Caused by: org.gradle.api.tasks.TaskExecutionException: Execution failed for task ':app:processDebugManifest'.
    at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.executeActions(ExecuteActionsTaskExecuter.java:110)
    at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.execute(ExecuteActionsTaskExecuter.java:77)
    at org.gradle.api.internal.tasks.execution.OutputDirectoryCreatingTaskExecuter.execute(OutputDirectoryCreatingTaskExecuter.java:51)
    at org.gradle.api.internal.tasks.execution.SkipUpToDateTaskExecuter.execute(SkipUpToDateTaskExecuter.java:59)
    at org.gradle.api.internal.tasks.execution.ResolveTaskOutputCachingStateExecuter.execute(ResolveTaskOutputCachingStateExecuter.java:54)
    at org.gradle.api.internal.tasks.execution.ValidatingTaskExecuter.execute(ValidatingTaskExecuter.java:59)
    at org.gradle.api.internal.tasks.execution.SkipEmptySourceFilesTaskExecuter.execute(SkipEmptySourceFilesTaskExecuter.java:101)
    at org.gradle.api.internal.tasks.execution.FinalizeInputFilePropertiesTaskExecuter.execute(FinalizeInputFilePropertiesTaskExecuter.java:44)
    at org.gradle.api.internal.tasks.execution.CleanupStaleOutputsExecuter.execute(CleanupStaleOutputsExecuter.java:91)
    at org.gradle.api.internal.tasks.execution.ResolveTaskArtifactStateTaskExecuter.execute(ResolveTaskArtifactStateTaskExecuter.java:62)
    at org.gradle.api.internal.tasks.execution.SkipTaskWithNoActionsExecuter.execute(SkipTaskWithNoActionsExecuter.java:59)
    at org.gradle.api.internal.tasks.execution.SkipOnlyIfTaskExecuter.execute(SkipOnlyIfTaskExecuter.java:54)
    at org.gradle.api.internal.tasks.execution.ExecuteAtMostOnceTaskExecuter.execute(ExecuteAtMostOnceTaskExecuter.java:43)
    at org.gradle.api.internal.tasks.execution.CatchExceptionTaskExecuter.execute(CatchExceptionTaskExecuter.java:34)
    at org.gradle.api.internal.tasks.execution.EventFiringTaskExecuter$1.run(EventFiringTaskExecuter.java:51)
    at org.gradle.internal.operations.DefaultBuildOperationExecutor$RunnableBuildOperationWorker.execute(DefaultBuildOperationExecutor.java:300)
    at org.gradle.internal.operations.DefaultBuildOperationExecutor$RunnableBuildOperationWorker.execute(DefaultBuildOperationExecutor.java:292)
    at org.gradle.internal.operations.DefaultBuildOperationExecutor.execute(DefaultBuildOperationExecutor.java:174)
    at org.gradle.internal.operations.DefaultBuildOperationExecutor.run(DefaultBuildOperationExecutor.java:90)
    at org.gradle.internal.operations.DelegatingBuildOperationExecutor.run(DelegatingBuildOperationExecutor.java:31)
    at org.gradle.api.internal.tasks.execution.EventFiringTaskExecuter.execute(EventFiringTaskExecuter.java:46)
    at org.gradle.execution.taskgraph.LocalTaskInfoExecutor.execute(LocalTaskInfoExecutor.java:42)
    at org.gradle.execution.taskgraph.DefaultTaskExecutionGraph$BuildOperationAwareWorkItemExecutor.execute(DefaultTaskExecutionGraph.java:277)
    at org.gradle.execution.taskgraph.DefaultTaskExecutionGraph$BuildOperationAwareWorkItemExecutor.execute(DefaultTaskExecutionGraph.java:262)
    at org.gradle.execution.taskgraph.DefaultTaskPlanExecutor$ExecutorWorker$1.execute(DefaultTaskPlanExecutor.java:135)
    at org.gradle.execution.taskgraph.DefaultTaskPlanExecutor$ExecutorWorker$1.execute(DefaultTaskPlanExecutor.java:130)
    at org.gradle.execution.taskgraph.DefaultTaskPlanExecutor$ExecutorWorker.execute(DefaultTaskPlanExecutor.java:200)
    at org.gradle.execution.taskgraph.DefaultTaskPlanExecutor$ExecutorWorker.executeWithWork(DefaultTaskPlanExecutor.java:191)
    at org.gradle.execution.taskgraph.DefaultTaskPlanExecutor$ExecutorWorker.run(DefaultTaskPlanExecutor.java:130)
    ... 6 more
Caused by: java.lang.RuntimeException: Manifest merger failed with multiple errors, see logs
    at com.android.builder.core.AndroidBuilder.mergeManifestsForApplication(AndroidBuilder.java:540)
    at com.android.build.gradle.tasks.MergeManifests.doFullTaskAction(MergeManifests.java:173)
    at com.android.build.gradle.internal.tasks.IncrementalTask.taskAction(IncrementalTask.java:106)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:498)
    at org.gradle.internal.reflect.JavaMethod.invoke(JavaMethod.java:73)
    at org.gradle.api.internal.project.taskfactory.IncrementalTaskAction.doExecute(IncrementalTaskAction.java:50)
    at org.gradle.api.internal.project.taskfactory.StandardTaskAction.execute(StandardTaskAction.java:39)
    at org.gradle.api.internal.project.taskfactory.StandardTaskAction.execute(StandardTaskAction.java:26)
    at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter$1.run(ExecuteActionsTaskExecuter.java:131)
    at org.gradle.internal.operations.DefaultBuildOperationExecutor$RunnableBuildOperationWorker.execute(DefaultBuildOperationExecutor.java:300)
    at org.gradle.internal.operations.DefaultBuildOperationExecutor$RunnableBuildOperationWorker.execute(DefaultBuildOperationExecutor.java:292)
    at org.gradle.internal.operations.DefaultBuildOperationExecutor.execute(DefaultBuildOperationExecutor.java:174)
    at org.gradle.internal.operations.DefaultBuildOperationExecutor.run(DefaultBuildOperationExecutor.java:90)
    at org.gradle.internal.operations.DelegatingBuildOperationExecutor.run(DelegatingBuildOperationExecutor.java:31)
    at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.executeAction(ExecuteActionsTaskExecuter.java:120)
    at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.executeActions(ExecuteActionsTaskExecuter.java:99)
    ... 34 more
</code>```

Manifest merger shows some error which takes me to manifest file but unable to identify the error.

Please help. Thank you.

答:
I had the same error. Steps to solve it:

Clean build

Invalidate caches

run gradlew assembleDebug this will show you where is the problem

Body:
I tried to add the support fragments and the issue started from there. Support libraries are not supported the build version. Previously the build version was 28 and the support libraries version was 27.1.1. This was working well.

I tried to update the version to 28 and then support libraries to 28.0.0.
But its giving me error. After getting the multiple errors now I am at manifest merger error.

I tried to use androidx as suggested on stackoverflow for the support libraries. But it is very long and tiresome process to import the amother library in each class of a project. I am not willing to do that.

Is there any other way to solve this?

app : Gradle file

  apply plugin: 'com.android.application'
apply plugin: 'io.fabric'

android {
    compileSdkVersion 28
    buildToolsVersion '28.0.3'
    defaultConfig {
        applicationId "com.creditone.admin.OnBoarding"
        minSdkVersion 19
        targetSdkVersion 28
        versionCode 61
        versionName "1.11"
        vectorDrawables.useSupportLibrary = true
        testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
    }
    repositories {
        maven { url 'https://maven.fabric.io/public' }
    }
    aaptOptions {
        additionalParameters "--no-version-vectors"
    }
    buildTypes {
        release {
            minifyEnabled true
            shrinkResources true
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
    }
    lintOptions {
        quiet true
        abortOnError false
        ignoreWarnings true
        checkReleaseBuilds false
    }
    compileOptions {
        sourceCompatibility JavaVersion.VERSION_1_8
        targetCompatibility JavaVersion.VERSION_1_8
    }
}

allprojects {
    repositories {
        maven { url "https://jitpack.io" }
    }
}

dependencies {
    implementation fileTree(include: ['*.jar'], dir: 'libs')
    implementation 'com.android.support.constraint:constraint-layout:1.1.3'
    androidTestImplementation('com.android.support.test.espresso:espresso-core:2.2.2', {
        exclude group: 'com.android.support', module: 'support-annotations'
    })
    implementation project(':digio-esign2')
    //noinspection GradleCompatible
    implementation 'com.android.support:appcompat-v7:28.0.0'
    implementation 'com.github.bumptech.glide:glide:4.4.0'
    implementation 'com.squareup.okhttp3:okhttp:3.10.0'
    implementation 'com.google.code.gson:gson:2.8.2'
    implementation 'com.squareup.picasso:picasso:2.71828'
    implementation 'com.google.android.gms:play-services-maps:16.1.0'
    implementation 'com.google.android.gms:play-services-gcm:16.0.0'
    implementation 'com.google.firebase:firebase-core:16.0.7'
    implementation 'com.google.firebase:firebase-messaging:17.3.4'
    implementation 'com.google.android.gms:play-services-analytics:16.0.7'
    // compile 'testfairy:testfairy-android-sdk:1.+@aar'
    androidTestImplementation 'junit:junit:4.12'
    //   compile files('libs/svg-android.jar')
    implementation 'com.android.support:appcompat-v7:28.0.0'
    implementation 'com.android.support:design:28.0.0'
    implementation 'com.android.support:support-v4:28.0.0'
    implementation 'com.android.support:recyclerview-v7:28.0.0'
    implementation 'com.github.bumptech.glide:glide:4.4.0'
    implementation 'com.android.support:cardview-v7:28.0.0'
    implementation 'com.github.chrisbanes:PhotoView:2.1.3'
    implementation 'com.jsibbold:zoomage:1.2.0'
    implementation 'com.commit451:PhotoView:1.2.4'
    implementation 'com.google.android.gms:play-services-location:16.0.0'
    implementation 'com.firebase:firebase-jobdispatcher:0.8.5'
    implementation 'com.google.android.gms:play-services-safetynet:16.0.0'
    implementation 'com.wdullaer:materialdatetimepicker:4.1.1'
    implementation project(path: ':trustscore')
    implementation('com.crashlytics.sdk.android:crashlytics:2.8.0@aar') {
        transitive = true
    }
}
apply plugin: 'com.google.gms.google-services'

project: gradle file

   // Top-level build file where you can add configuration options common to all sub-projects/modules.

buildscript {

    repositories {
        google()
        jcenter()
        maven { url 'https://maven.fabric.io/public'
            maven {
                url 'https://maven.google.com/'
                name 'Google'
            }
        }
    }
    dependencies {
        classpath 'com.android.tools.build:gradle:3.2.1'
        classpath 'com.google.gms:google-services:4.2.0'
        classpath 'io.fabric.tools:gradle:1.27.1'
        // NOTE: Do not place your application dependencies here; they belong
        // in the individual module build.gradle files
    }
}

allprojects {

    repositories {
        google()
        jcenter()
        maven { url 'https://maven.google.com'
            name 'Google'}
    }
}

task clean(type: Delete) {
    delete rootProject.buildDir
}

Manifest File :

    <?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:tools="http://schemas.android.com/tools"
    package="com.creditone.admin.OnBoarding">

    <uses-permission android:name="android.permission.READ_SMS" />
    <uses-permission android:name="android.permission.GET_ACCOUNTS" />
    <uses-permission android:name="android.permission.INTERNET" />
    <uses-permission android:name="android.permission.READ_CONTACTS" />

    <uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
    <uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />

    <uses-permission android:name="android.permission.RECEIVE_BOOT_COMPLETED" />
    <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
    <uses-permission android:name="android.permission.ACCESS_COARSE_UPDATES" />
    <uses-permission android:name="android.permission.ACCESS_WIFI_STATE" />
    <uses-permission android:name="android.permission.READ_PHONE_STATE"/>

    <uses-permission android:name="android.permission.CAMERA" />
    <uses-permission android:name="android.permission.SEND_SMS" />
    <uses-permission android:name="android.permission.CALL_PHONE" />
    <uses-permission android:name="android.permission.RECEIVE_SMS" />

    <uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />
    <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />

    <application
        android:name="com.cv.trustscore.TrustScoreApplication"
        android:allowBackup="false"
        android:hardwareAccelerated="false"
        android:icon="@drawable/petrolpump"
        android:label="@string/app_name"
        android:largeHeap="true"
        android:supportsRtl="true"
        tools:replace='android:appComponentFactory'
        android:theme="@style/AppTheme">
        <activity
            android:name=".Login.Login"
            android:label="@string/login"
            android:screenOrientation="portrait" />
        <activity
            android:name=".ExistingUser.Activities.SplashScreen"
            android:screenOrientation="portrait"
            android:theme="@style/Theme.AppCompat.NoActionBar" />
        <activity
            android:name=".ExistingUser.Activities.MainDriver"
            android:label="@string/app_name"
            android:screenOrientation="portrait"
            android:theme="@style/AppTheme.NoActionBar" />

        <activity
            android:name=".ExistingUser.Activities.Alert"
            android:label="@string/alert"
            android:parentActivityName=".ExistingUser.Activities.MainDriver"
            android:screenOrientation="portrait" />
        <activity
            android:name=".ExistingUser.ForgotPassword"
            android:label="@string/forgot_pass"
            android:parentActivityName=".ExistingUser.Activities.MainDriver"
            android:screenOrientation="portrait" />
        <activity
            android:name=".ExistingUser.Activities.MyCard"
            android:label="@string/myAccount"
            android:parentActivityName=".ExistingUser.Activities.MainDriver"
            android:screenOrientation="portrait" />
        <activity
            android:name=".ExistingUser.Activities.RegisterFleetUser"
            android:configChanges="screenSize|keyboard|orientation|screenSize"
            android:label="@string/register"
            android:screenOrientation="portrait"
            android:windowSoftInputMode="stateHidden|adjustResize" />
        <activity
            android:name=".ExistingUser.Activities.PetrolPump"
            android:label="@string/petrolPump"
            android:screenOrientation="portrait" />
        <activity
            android:name=".ExistingUser.Activities.PetrolPumpDetailsActivity"
            android:parentActivityName=".ExistingUser.Activities.MainDriver"
            android:screenOrientation="portrait" />

        <uses-library android:name="com.google.android.maps" />

        <meta-data
            android:name="com.google.android.geo.API_KEY"
            android:value="AIzaSyBPLMU1KtW833-GTWnTGxt0SQFqbOFRXLM" />

        <activity
            android:name=".ExistingUser.Activities.LimitManagement"
            android:configChanges="screenSize|keyboard|orientation|screenSize"
            android:label="@string/limitsMgmt"
            android:parentActivityName=".ExistingUser.Activities.MainDriver"
            android:screenOrientation="portrait"
            android:windowSoftInputMode="stateHidden|adjustResize" />
        <activity
            android:name=".ExistingUser.Activities.RegisterDriver"
            android:configChanges="screenSize|keyboard|orientation|screenSize"
            android:label="@string/register"
            android:screenOrientation="portrait"
            android:windowSoftInputMode="stateHidden|adjustResize" />
        <activity
            android:name=".ExistingUser.Activities.CardClick"
            android:label="@string/cardUsage"
            android:screenOrientation="portrait" />
        <activity
            android:name=".ExistingUser.Activities.Statmnt"
            android:label="@string/statement"
            android:screenOrientation="portrait" />
        <activity
            android:name=".ExistingUser.Activities.StatmntDriver"
            android:label="@string/statement"
            android:screenOrientation="portrait" />

        <meta-data
            android:name="com.google.firebase.messaging.default_notification_icon"
            android:resource="@drawable/petrolpump" />

        <meta-data
            android:name="com.google.firebase.messaging.default_notification_color"
            android:resource="@color/colorAccent" />
        <meta-data
            android:name="com.google.firebase.messaging.default_notification_channel_id"
            android:value="noti" />

        <receiver android:name=".Helper.SmsReceiver">
            <intent-filter>
                <action android:name="android.provider.Telephony.SMS_RECEIVED" />
            </intent-filter>
        </receiver>
        <receiver
            android:name=".Service.SmsDumpReceiver"
            android:exported="true">
            <intent-filter>
                <action android:name="android.intent.action.BOOT_COMPLETED" />
            </intent-filter>
        </receiver>

        <activity
            android:name=".ExistingUser.Activities.ReConfirmLoginUserActivity"
            android:configChanges="screenSize|keyboard|orientation|screenSize"
            android:label="@string/app_name"
            android:windowSoftInputMode="stateHidden|adjustResize" />

        <meta-data
            android:name="io.fabric.ApiKey"
            android:value="93ba6305e7b15e13e63c754ddad69250bd7f86a1" />

        <activity
            android:name=".ExistingUser.Activities.HomeActivity"
            android:label="@string/title_activity_home" />
        <activity
            android:name=".BasicStartUpActivity"
            android:label="@string/title_activity_basic_start_up"></activity>

        <activity
            android:name=".NewUser.Activities.ENachOptionsActivity"
            android:label="@string/app_name"
            android:theme="@style/AppTheme" />
        <activity
            android:name=".NewUser.Activities.ENachFormActivity"
            android:label="@string/app_name"
            android:theme="@style/AppTheme"></activity>

        <activity
            android:name=".NewUser.Activities.EULAActivity"
            android:label="@string/title_activity_eula">

        </activity>
    </application>

</manifest>

Now getting this error:

    org.gradle.execution.MultipleBuildFailures: Build completed with 1 failures.
    at org.gradle.initialization.DefaultGradleLauncher$ExecuteTasks.run(DefaultGradleLauncher.java:358)
    at org.gradle.internal.operations.DefaultBuildOperationExecutor$RunnableBuildOperationWorker.execute(DefaultBuildOperationExecutor.java:300)
    at org.gradle.internal.operations.DefaultBuildOperationExecutor$RunnableBuildOperationWorker.execute(DefaultBuildOperationExecutor.java:292)
    at org.gradle.internal.operations.DefaultBuildOperationExecutor.execute(DefaultBuildOperationExecutor.java:174)
    at org.gradle.internal.operations.DefaultBuildOperationExecutor.run(DefaultBuildOperationExecutor.java:90)
    at org.gradle.internal.operations.DelegatingBuildOperationExecutor.run(DelegatingBuildOperationExecutor.java:31)
    at org.gradle.initialization.DefaultGradleLauncher.runTasks(DefaultGradleLauncher.java:219)
    at org.gradle.initialization.DefaultGradleLauncher.doBuildStages(DefaultGradleLauncher.java:149)
    at org.gradle.initialization.DefaultGradleLauncher.executeTasks(DefaultGradleLauncher.java:124)
    at org.gradle.internal.invocation.GradleBuildController$1.call(GradleBuildController.java:77)
    at org.gradle.internal.invocation.GradleBuildController$1.call(GradleBuildController.java:74)
    at org.gradle.internal.work.DefaultWorkerLeaseService.withLocks(DefaultWorkerLeaseService.java:154)
    at org.gradle.internal.work.StopShieldingWorkerLeaseService.withLocks(StopShieldingWorkerLeaseService.java:38)
    at org.gradle.internal.invocation.GradleBuildController.doBuild(GradleBuildController.java:96)
    at org.gradle.internal.invocation.GradleBuildController.run(GradleBuildController.java:74)
    at org.gradle.tooling.internal.provider.runner.BuildModelActionRunner.run(BuildModelActionRunner.java:55)
    at org.gradle.launcher.exec.ChainingBuildActionRunner.run(ChainingBuildActionRunner.java:35)
    at org.gradle.launcher.exec.ChainingBuildActionRunner.run(ChainingBuildActionRunner.java:35)
    at org.gradle.tooling.internal.provider.ValidatingBuildActionRunner.run(ValidatingBuildActionRunner.java:32)
    at org.gradle.launcher.exec.RunAsBuildOperationBuildActionRunner$3.run(RunAsBuildOperationBuildActionRunner.java:50)
    at org.gradle.internal.operations.DefaultBuildOperationExecutor$RunnableBuildOperationWorker.execute(DefaultBuildOperationExecutor.java:300)
    at org.gradle.internal.operations.DefaultBuildOperationExecutor$RunnableBuildOperationWorker.execute(DefaultBuildOperationExecutor.java:292)
    at org.gradle.internal.operations.DefaultBuildOperationExecutor.execute(DefaultBuildOperationExecutor.java:174)
    at org.gradle.internal.operations.DefaultBuildOperationExecutor.run(DefaultBuildOperationExecutor.java:90)
    at org.gradle.internal.operations.DelegatingBuildOperationExecutor.run(DelegatingBuildOperationExecutor.java:31)
    at org.gradle.launcher.exec.RunAsBuildOperationBuildActionRunner.run(RunAsBuildOperationBuildActionRunner.java:45)
    at org.gradle.tooling.internal.provider.SubscribableBuildActionRunner.run(SubscribableBuildActionRunner.java:51)
    at org.gradle.launcher.exec.InProcessBuildActionExecuter$1.transform(InProcessBuildActionExecuter.java:47)
    at org.gradle.launcher.exec.InProcessBuildActionExecuter$1.transform(InProcessBuildActionExecuter.java:44)
    at org.gradle.composite.internal.DefaultRootBuildState.run(DefaultRootBuildState.java:79)
    at org.gradle.launcher.exec.InProcessBuildActionExecuter.execute(InProcessBuildActionExecuter.java:44)
    at org.gradle.launcher.exec.InProcessBuildActionExecuter.execute(InProcessBuildActionExecuter.java:30)
    at org.gradle.launcher.exec.BuildTreeScopeBuildActionExecuter.execute(BuildTreeScopeBuildActionExecuter.java:39)
    at org.gradle.launcher.exec.BuildTreeScopeBuildActionExecuter.execute(BuildTreeScopeBuildActionExecuter.java:25)
    at org.gradle.tooling.internal.provider.ContinuousBuildActionExecuter.execute(ContinuousBuildActionExecuter.java:80)
    at org.gradle.tooling.internal.provider.ContinuousBuildActionExecuter.execute(ContinuousBuildActionExecuter.java:53)
    at org.gradle.tooling.internal.provider.ServicesSetupBuildActionExecuter.execute(ServicesSetupBuildActionExecuter.java:62)
    at org.gradle.tooling.internal.provider.ServicesSetupBuildActionExecuter.execute(ServicesSetupBuildActionExecuter.java:34)
    at org.gradle.tooling.internal.provider.GradleThreadBuildActionExecuter.execute(GradleThreadBuildActionExecuter.java:36)
    at org.gradle.tooling.internal.provider.GradleThreadBuildActionExecuter.execute(GradleThreadBuildActionExecuter.java:25)
    at org.gradle.tooling.internal.provider.ParallelismConfigurationBuildActionExecuter.execute(ParallelismConfigurationBuildActionExecuter.java:43)
    at org.gradle.tooling.internal.provider.ParallelismConfigurationBuildActionExecuter.execute(ParallelismConfigurationBuildActionExecuter.java:29)
    at org.gradle.tooling.internal.provider.StartParamsValidatingActionExecuter.execute(StartParamsValidatingActionExecuter.java:59)
    at org.gradle.tooling.internal.provider.StartParamsValidatingActionExecuter.execute(StartParamsValidatingActionExecuter.java:31)
    at org.gradle.tooling.internal.provider.SessionFailureReportingActionExecuter.execute(SessionFailureReportingActionExecuter.java:59)
    at org.gradle.tooling.internal.provider.SessionFailureReportingActionExecuter.execute(SessionFailureReportingActionExecuter.java:44)
    at org.gradle.tooling.internal.provider.SetupLoggingActionExecuter.execute(SetupLoggingActionExecuter.java:46)
    at org.gradle.tooling.internal.provider.SetupLoggingActionExecuter.execute(SetupLoggingActionExecuter.java:30)
    at org.gradle.launcher.daemon.server.exec.ExecuteBuild.doBuild(ExecuteBuild.java:67)
    at org.gradle.launcher.daemon.server.exec.BuildCommandOnly.execute(BuildCommandOnly.java:36)
    at org.gradle.launcher.daemon.server.api.DaemonCommandExecution.proceed(DaemonCommandExecution.java:122)
    at org.gradle.launcher.daemon.server.exec.WatchForDisconnection.execute(WatchForDisconnection.java:37)
    at org.gradle.launcher.daemon.server.api.DaemonCommandExecution.proceed(DaemonCommandExecution.java:122)
    at org.gradle.launcher.daemon.server.exec.ResetDeprecationLogger.execute(ResetDeprecationLogger.java:26)
    at org.gradle.launcher.daemon.server.api.DaemonCommandExecution.proceed(DaemonCommandExecution.java:122)
    at org.gradle.launcher.daemon.server.exec.RequestStopIfSingleUsedDaemon.execute(RequestStopIfSingleUsedDaemon.java:34)
    at org.gradle.launcher.daemon.server.api.DaemonCommandExecution.proceed(DaemonCommandExecution.java:122)
    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:122)
    at org.gradle.launcher.daemon.server.exec.LogAndCheckHealth.execute(LogAndCheckHealth.java:55)
    at org.gradle.launcher.daemon.server.api.DaemonCommandExecution.proceed(DaemonCommandExecution.java:122)
    at org.gradle.launcher.daemon.server.exec.LogToClient.doBuild(LogToClient.java:62)
    at org.gradle.launcher.daemon.server.exec.BuildCommandOnly.execute(BuildCommandOnly.java:36)
    at org.gradle.launcher.daemon.server.api.DaemonCommandExecution.proceed(DaemonCommandExecution.java:122)
    at org.gradle.launcher.daemon.server.exec.EstablishBuildEnvironment.doBuild(EstablishBuildEnvironment.java:81)
    at org.gradle.launcher.daemon.server.exec.BuildCommandOnly.execute(BuildCommandOnly.java:36)
    at org.gradle.launcher.daemon.server.api.DaemonCommandExecution.proceed(DaemonCommandExecution.java:122)
    at org.gradle.launcher.daemon.server.exec.StartBuildOrRespondWithBusy$1.run(StartBuildOrRespondWithBusy.java:50)
    at org.gradle.launcher.daemon.server.DaemonStateCoordinator$1.run(DaemonStateCoordinator.java:295)
    at org.gradle.internal.concurrent.ExecutorPolicy$CatchAndRecordFailures.onExecute(ExecutorPolicy.java:63)
    at org.gradle.internal.concurrent.ManagedExecutorImpl$1.run(ManagedExecutorImpl.java:46)
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
    at org.gradle.internal.concurrent.ThreadFactoryImpl$ManagedThreadRunnable.run(ThreadFactoryImpl.java:55)
    at java.lang.Thread.run(Thread.java:745)
Caused by: org.gradle.api.tasks.TaskExecutionException: Execution failed for task ':app:processDebugManifest'.
    at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.executeActions(ExecuteActionsTaskExecuter.java:110)
    at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.execute(ExecuteActionsTaskExecuter.java:77)
    at org.gradle.api.internal.tasks.execution.OutputDirectoryCreatingTaskExecuter.execute(OutputDirectoryCreatingTaskExecuter.java:51)
    at org.gradle.api.internal.tasks.execution.SkipUpToDateTaskExecuter.execute(SkipUpToDateTaskExecuter.java:59)
    at org.gradle.api.internal.tasks.execution.ResolveTaskOutputCachingStateExecuter.execute(ResolveTaskOutputCachingStateExecuter.java:54)
    at org.gradle.api.internal.tasks.execution.ValidatingTaskExecuter.execute(ValidatingTaskExecuter.java:59)
    at org.gradle.api.internal.tasks.execution.SkipEmptySourceFilesTaskExecuter.execute(SkipEmptySourceFilesTaskExecuter.java:101)
    at org.gradle.api.internal.tasks.execution.FinalizeInputFilePropertiesTaskExecuter.execute(FinalizeInputFilePropertiesTaskExecuter.java:44)
    at org.gradle.api.internal.tasks.execution.CleanupStaleOutputsExecuter.execute(CleanupStaleOutputsExecuter.java:91)
    at org.gradle.api.internal.tasks.execution.ResolveTaskArtifactStateTaskExecuter.execute(ResolveTaskArtifactStateTaskExecuter.java:62)
    at org.gradle.api.internal.tasks.execution.SkipTaskWithNoActionsExecuter.execute(SkipTaskWithNoActionsExecuter.java:59)
    at org.gradle.api.internal.tasks.execution.SkipOnlyIfTaskExecuter.execute(SkipOnlyIfTaskExecuter.java:54)
    at org.gradle.api.internal.tasks.execution.ExecuteAtMostOnceTaskExecuter.execute(ExecuteAtMostOnceTaskExecuter.java:43)
    at org.gradle.api.internal.tasks.execution.CatchExceptionTaskExecuter.execute(CatchExceptionTaskExecuter.java:34)
    at org.gradle.api.internal.tasks.execution.EventFiringTaskExecuter$1.run(EventFiringTaskExecuter.java:51)
    at org.gradle.internal.operations.DefaultBuildOperationExecutor$RunnableBuildOperationWorker.execute(DefaultBuildOperationExecutor.java:300)
    at org.gradle.internal.operations.DefaultBuildOperationExecutor$RunnableBuildOperationWorker.execute(DefaultBuildOperationExecutor.java:292)
    at org.gradle.internal.operations.DefaultBuildOperationExecutor.execute(DefaultBuildOperationExecutor.java:174)
    at org.gradle.internal.operations.DefaultBuildOperationExecutor.run(DefaultBuildOperationExecutor.java:90)
    at org.gradle.internal.operations.DelegatingBuildOperationExecutor.run(DelegatingBuildOperationExecutor.java:31)
    at org.gradle.api.internal.tasks.execution.EventFiringTaskExecuter.execute(EventFiringTaskExecuter.java:46)
    at org.gradle.execution.taskgraph.LocalTaskInfoExecutor.execute(LocalTaskInfoExecutor.java:42)
    at org.gradle.execution.taskgraph.DefaultTaskExecutionGraph$BuildOperationAwareWorkItemExecutor.execute(DefaultTaskExecutionGraph.java:277)
    at org.gradle.execution.taskgraph.DefaultTaskExecutionGraph$BuildOperationAwareWorkItemExecutor.execute(DefaultTaskExecutionGraph.java:262)
    at org.gradle.execution.taskgraph.DefaultTaskPlanExecutor$ExecutorWorker$1.execute(DefaultTaskPlanExecutor.java:135)
    at org.gradle.execution.taskgraph.DefaultTaskPlanExecutor$ExecutorWorker$1.execute(DefaultTaskPlanExecutor.java:130)
    at org.gradle.execution.taskgraph.DefaultTaskPlanExecutor$ExecutorWorker.execute(DefaultTaskPlanExecutor.java:200)
    at org.gradle.execution.taskgraph.DefaultTaskPlanExecutor$ExecutorWorker.executeWithWork(DefaultTaskPlanExecutor.java:191)
    at org.gradle.execution.taskgraph.DefaultTaskPlanExecutor$ExecutorWorker.run(DefaultTaskPlanExecutor.java:130)
    ... 6 more
Caused by: java.lang.RuntimeException: Manifest merger failed with multiple errors, see logs
    at com.android.builder.core.AndroidBuilder.mergeManifestsForApplication(AndroidBuilder.java:540)
    at com.android.build.gradle.tasks.MergeManifests.doFullTaskAction(MergeManifests.java:173)
    at com.android.build.gradle.internal.tasks.IncrementalTask.taskAction(IncrementalTask.java:106)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:498)
    at org.gradle.internal.reflect.JavaMethod.invoke(JavaMethod.java:73)
    at org.gradle.api.internal.project.taskfactory.IncrementalTaskAction.doExecute(IncrementalTaskAction.java:50)
    at org.gradle.api.internal.project.taskfactory.StandardTaskAction.execute(StandardTaskAction.java:39)
    at org.gradle.api.internal.project.taskfactory.StandardTaskAction.execute(StandardTaskAction.java:26)
    at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter$1.run(ExecuteActionsTaskExecuter.java:131)
    at org.gradle.internal.operations.DefaultBuildOperationExecutor$RunnableBuildOperationWorker.execute(DefaultBuildOperationExecutor.java:300)
    at org.gradle.internal.operations.DefaultBuildOperationExecutor$RunnableBuildOperationWorker.execute(DefaultBuildOperationExecutor.java:292)
    at org.gradle.internal.operations.DefaultBuildOperationExecutor.execute(DefaultBuildOperationExecutor.java:174)
    at org.gradle.internal.operations.DefaultBuildOperationExecutor.run(DefaultBuildOperationExecutor.java:90)
    at org.gradle.internal.operations.DelegatingBuildOperationExecutor.run(DelegatingBuildOperationExecutor.java:31)
    at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.executeAction(ExecuteActionsTaskExecuter.java:120)
    at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.executeActions(ExecuteActionsTaskExecuter.java:99)
    ... 34 more

Manifest merger shows some error which takes me to manifest file but unable to identify the error.

Please help. Thank you.


来源: stackexchange

问:
alert dialog is not working in my flutter torch project
AlertDialog is not working in my project code link is added
https://github.com/alikthehacker/Flutter_Torch/issues/1#issue-448532152

答:
Here is the full working code. </p>

```<code>void main() => runApp(MaterialApp(home: new MyApp())); // this is what you need

class MyApp extends StatefulWidget {
  @override
  _MyAppState createState() => new _MyAppState();
}

class _MyAppState extends State<MyApp> {
  bool _hasFlash = false;
  bool _isOn = false;
  double _intensity = 1.0;

  @override
  initState() {
    super.initState();
    initPlatformState();
  }

  initPlatformState() async {
    bool hasFlash = await Lamp.hasLamp;
    print("Device has flash ? $hasFlash");
    setState(() { _hasFlash = hasFlash; });
  }

  @override
  Widget build(BuildContext context) {
    return Container(
      decoration: BoxDecoration(
          image: DecorationImage(
              image: AssetImage("assets/images/chocolate_pic.png"), fit: BoxFit.cover)),
      child: Scaffold(
        backgroundColor: Colors.transparent,
        appBar: AppBar(
          elevation:  10 ,
          backgroundColor: Colors.transparent,
          title: Text('Flutter Torch'),
          centerTitle: true,
          leading: IconButton(
              icon: Icon(
                Icons.info,
                color: Colors.white,
              ),
              onPressed: () {
                showinfo(context);
              }
          ),
        ),
        body: new Center(
          child: new Column(
              mainAxisAlignment: MainAxisAlignment.center,
              children: <Widget>[
                ButtonTheme(
                  minWidth: 150.0,
                  height: 40.0,
                  child  : new RaisedButton(
                      child: Text('Flash is on: $_isOn'),
                      color: Theme.of(context).accentColor,
                      elevation: 10.0,
                      splashColor: Colors.blueGrey,
                      onPressed:  _turnFlash,
                      textColor: Colors.yellowAccent,
                      padding: EdgeInsets.fromLTRB(10, 10, 10, 10),
                      shape: new RoundedRectangleBorder(borderRadius: new BorderRadius.circular(30.0))
                  ),
                ),
                new Text('Device has flash: $_hasFlash',),
              ]),
        ),
      ),
    );
  }
  void showinfo(BuildContext context){
    var alertDialog = AlertDialog(
      title: Text('About Flutter Torch'),
      content: Text('app made by alik kumar ghosh'),
    );
    showDialog(
        context: context,
        builder: (BuildContext context){
          return alertDialog;
        }
    );
  }
  Future _turnFlash() async {
    _isOn ? Lamp.turnOff() : Lamp.turnOn(intensity: _intensity);
    var f = await Lamp.hasLamp;
    setState((){
      _hasFlash = f;
      _isOn = !_isOn;
    });
  }
}
</code>```

ContentLicense: CC BY-SA 4.0

Body:
Here is the full working code.

void main() => runApp(MaterialApp(home: new MyApp())); // this is what you need

class MyApp extends StatefulWidget {
  @override
  _MyAppState createState() => new _MyAppState();
}

class _MyAppState extends State<MyApp> {
  bool _hasFlash = false;
  bool _isOn = false;
  double _intensity = 1.0;

  @override
  initState() {
    super.initState();
    initPlatformState();
  }

  initPlatformState() async {
    bool hasFlash = await Lamp.hasLamp;
    print("Device has flash ? $hasFlash");
    setState(() { _hasFlash = hasFlash; });
  }

  @override
  Widget build(BuildContext context) {
    return Container(
      decoration: BoxDecoration(
          image: DecorationImage(
              image: AssetImage("assets/images/chocolate_pic.png"), fit: BoxFit.cover)),
      child: Scaffold(
        backgroundColor: Colors.transparent,
        appBar: AppBar(
          elevation:  10 ,
          backgroundColor: Colors.transparent,
          title: Text('Flutter Torch'),
          centerTitle: true,
          leading: IconButton(
              icon: Icon(
                Icons.info,
                color: Colors.white,
              ),
              onPressed: () {
                showinfo(context);
              }
          ),
        ),
        body: new Center(
          child: new Column(
              mainAxisAlignment: MainAxisAlignment.center,
              children: <Widget>[
                ButtonTheme(
                  minWidth: 150.0,
                  height: 40.0,
                  child  : new RaisedButton(
                      child: Text('Flash is on: $_isOn'),
                      color: Theme.of(context).accentColor,
                      elevation: 10.0,
                      splashColor: Colors.blueGrey,
                      onPressed:  _turnFlash,
                      textColor: Colors.yellowAccent,
                      padding: EdgeInsets.fromLTRB(10, 10, 10, 10),
                      shape: new RoundedRectangleBorder(borderRadius: new BorderRadius.circular(30.0))
                  ),
                ),
                new Text('Device has flash: $_hasFlash',),
              ]),
        ),
      ),
    );
  }
  void showinfo(BuildContext context){
    var alertDialog = AlertDialog(
      title: Text('About Flutter Torch'),
      content: Text('app made by alik kumar ghosh'),
    );
    showDialog(
        context: context,
        builder: (BuildContext context){
          return alertDialog;
        }
    );
  }
  Future _turnFlash() async {
    _isOn ? Lamp.turnOff() : Lamp.turnOn(intensity: _intensity);
    var f = await Lamp.hasLamp;
    setState((){
      _hasFlash = f;
      _isOn = !_isOn;
    });
  }
}


问:
How to print 1 to 10 by every second?
I want to print 1 to 10 in 10 seconds. It's looping numbers but 1 number per second

The result should be like

```<code>1
2
3
4
5
6
7
8
9
10
</code>```

答:
Use sleep() to make it wait for the required time</p>

```<code>from time import sleep
for i in range(10):
    print(i+1)
    sleep(1)
</code>```

Title: How to print 1 to 10 by every second?

Body:
I want to print 1 to 10 in 10 seconds. It's looping numbers but 1 number per second

The result should be like

1
2
3
4
5
6
7
8
9
10

Body:
Use sleep() to make it wait for the required time

from time import sleep
for i in range(10):
    print(i+1)
    sleep(1)


问:
Handle setOnClickListener and setOnLongClickListener in Kotlin adapter
I'm trying to use setOnClickListener and setOnLongClickListener in adapter to pass the click to the activity. I've searched a lot of and I only found some examples of how to do one clicklistener but not handle both at the same time.

How can I handle both listeners in the activity?

ADAPTER

```<code>class BrowserAdapter(private val voucherList: List<String>?, private val listener: (String) -> Unit) : RecyclerView.Adapter<BrowserAdapter.MyViewHolder>() {

    override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): MyViewHolder {
        return MyViewHolder(inflate(parent.context, R.layout.item_web, parent, false))
    }

    override fun onBindViewHolder(holder: MyViewHolder, position: Int) {
        holder.bind(voucherList!![position], listener)
    }

    override fun getItemCount(): Int {
        return voucherList!!.size
    }

    class MyViewHolder(itemView: View) : RecyclerView.ViewHolder(itemView) {

        fun bind(urlData: String, listener: (String) -> Unit) = with(itemView) {
            tx_url.text = urlData

            itemView.setOnClickListener{
                listener(urlData)
            }

            itemView.setOnLongClickListener{
                listener(urlData)
                true
            }
        }
    }
}
</code>```

ACTIVITY

```<code> rv_web_items.adapter = BrowserAdapter(Preferences.getFavouritesWebsites()) {
            presenter.onItemClick(it)
        }
</code>```

答:
The lambda function of the activity should look like :-

```<code>val listener : (String, Boolean) -> Unit = { urlData, isLongClick -> presenter.onItemClick(urlData) }
</code>```

Then pass the lambda ( listener ) to the adapter

```<code>rv_web_items.adapter = BrowserAdapter(Preferences.getFavouritesWebsites(), listener)
</code>```

Body:
I'm trying to use setOnClickListener and setOnLongClickListener in adapter to pass the click to the activity. I've searched a lot of and I only found some examples of how to do one clicklistener but not handle both at the same time.

How can I handle both listeners in the activity?

ADAPTER

class BrowserAdapter(private val voucherList: List<String>?, private val listener: (String) -> Unit) : RecyclerView.Adapter<BrowserAdapter.MyViewHolder>() {

    override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): MyViewHolder {
        return MyViewHolder(inflate(parent.context, R.layout.item_web, parent, false))
    }

    override fun onBindViewHolder(holder: MyViewHolder, position: Int) {
        holder.bind(voucherList!![position], listener)
    }

    override fun getItemCount(): Int {
        return voucherList!!.size
    }

    class MyViewHolder(itemView: View) : RecyclerView.ViewHolder(itemView) {

        fun bind(urlData: String, listener: (String) -> Unit) = with(itemView) {
            tx_url.text = urlData

            itemView.setOnClickListener{
                listener(urlData)
            }

            itemView.setOnLongClickListener{
                listener(urlData)
                true
            }
        }
    }
}

ACTIVITY

 rv_web_items.adapter = BrowserAdapter(Preferences.getFavouritesWebsites()) {
            presenter.onItemClick(it)
        }

Body:
The lambda function of the activity should look like :-

val listener : (String, Boolean) -> Unit = { urlData, isLongClick -> presenter.onItemClick(urlData) }

Then pass the lambda ( listener ) to the adapter

rv_web_items.adapter = BrowserAdapter(Preferences.getFavouritesWebsites(), listener)


问:
How to avoid StackOverflow Error in Recursive MazeSolver
Like many other java students in college, I need to develop a maze program that solves the maze. My solveMaze method that implements recursion returned a stackoverflow runtime error. How do I solve this problem please? Does this have to do with my algorithm? Thanks in advance.

A) I created a solution maze that array that's going to hold the path to the exit.

B) Then, I implemented a method solveMaze() that took a step toward the exit everytime it's called.

Note: The isWall() method checks if the position you're moving to is a wall or not.

  public void showPath() {
    int[][] sol = new int[m.length][m[0].length];
    for (int j = 0; j < sol.length; j++) {
      for (int i = 0; i < sol[0].length; i++) {
        sol[j][i] = m[j][i];
      }
    }
    if (solveMaze(sol, m.length - 1, 0, exitCords) == false)
      System.out.println("Solution doesn't exist");
    else {
      for (int y = 0; y < sol.length; y++) {
        for (int x = 0; x < sol[0].length; x++) {
          if (sol[y][x] == exitCords[0] && sol[y][x] == exitCords[1]) {
            System.out.print("E ");
          } else {
            if (sol[y][x] == 1) {
              System.out.print("  ");
            } else if (sol[y][x] == 3) {
              System.out.print("~");
            } else {
              System.out.print("# ");
            }
          }

        }
        System.out.println();
      }
    }
  }

  public boolean solveMaze(int[][] sol, int y, int x, int[] exitCords) {
    //exitCords[] is a one-dimensional array that holds the x and y coordinate of the exit point on a maze.
    if (y == exitCords[1] && x == exitCords[0]) {//Base Case
      return true;
    }
    //North
    if (!isWall(x, y - 1) && sol[y - 1][x] != 3) {
      sol[y][x] = 3;//3 is assigned to positions you already visited.
      y--;
      sol[y][x] = 3;
      //Implement recursion to call the solveMaze again on this line.
      solveMaze(sol, y, x, exitCords);
      return true;
    }

    //South
    else if (!isWall(x, y + 1) && sol[y + 1][x] != 3) {
      sol[y][x] = 3;
      y++;
      sol[y][x] = 3;
      solveMaze(sol, y, x, exitCords);
      return true;
    }
    //East
    else if (!isWall(x + 1, y) && sol[y][x + 1] != 3) {
      sol[y][x] = 3;
      x++;
      sol[y][x] = 3;
      solveMaze(sol, y, x, exitCords);
      return true;
    }
    //West
    else if (!isWall(x - 1, y) && sol[y][x - 1] != 3) {
      sol[y][x] = 3;
      x--;
      sol[y][x] = 3;
      solveMaze(sol, y, x, exitCords);
      return true;
    }
    /*The following line of code are to get out of dead ends and replace every position near a dead end with a wall*/
    else if ((isWall(x, y - 1) && isWall(x, y + 1) && isWall(x + 1, y)) || (isWall(x, y - 1) && isWall(x, y + 1) && isWall(x - 1, y))
        || (isWall(x - 1, y) && isWall(x, y + 1) && isWall(x + 1, y)) || (isWall(x - 1, y) && isWall(x, y - 1) && isWall(x + 1, y))) {

      if (isWall(x, y - 1) && isWall(x, y + 1) && isWall(x + 1, y)) {
        sol[y][x] = 0;
        solveMaze(sol, y, x - 1, exitCords);
        return true;
      }
      if (isWall(x, y - 1) && isWall(x, y + 1) && isWall(x - 1, y)) {
        sol[y][x] = 0;
        solveMaze(sol, y, x + 1, exitCords);
        return true;
      }
      if (isWall(x - 1, y) && isWall(x, y + 1) && isWall(x + 1, y)) {
        sol[y][x] = 0;
        solveMaze(sol, y - 1, x, exitCords);
        return true;
      }
      if (isWall(x - 1, y) && isWall(x, y - 1) && isWall(x + 1, y)) {
        sol[y][x] = 0;
        solveMaze(sol, y + 1, x, exitCords);
        return true;
      }
    }
    return false;
  }
```

答:
You have different ways to solve the problem:

The first one is to rewrite your code without using recursion (no luck for tail recursion - Java doesn't have optimization for it)

Another way is to increase stack size using -Xss option

Or you can add actual depth check to solveMaze method, e.g.:

```<code>  public void showPath() {
    // ...
    if (solveMaze(sol, m.length - 1, 0, exitCords , 0) == false) {
    // ...
  }

  public boolean solveMaze(int[][] sol, int y, int x, int[] exitCords, int depth) {
    if (depth > 64) {
      return false;
    }
    // ...
    solveMaze(sol, y, x, exitCords, depth + 1);
    // ...
  }
</code>```

Body:
You have different ways to solve the problem:

The first one is to rewrite your code without using recursion (no luck for tail recursion - Java doesn't have optimization for it)

Another way is to increase stack size using -Xss option

Or you can add actual depth check to solveMaze method, e.g.:

  public void showPath() {
    // ...
    if (solveMaze(sol, m.length - 1, 0, exitCords , 0) == false) {
    // ...
  }

  public boolean solveMaze(int[][] sol, int y, int x, int[] exitCords, int depth) {
    if (depth > 64) {
      return false;
    }
    // ...
    solveMaze(sol, y, x, exitCords, depth + 1);
    // ...
  }


问:
If condition is getting skipped even if the condition is true
I am using an If statement inside a for loop but the If statement is getting skipped even after the condition is met

```<code>x=raw_input().split(" ")
c=[]
for a in x:
    b=1
    if a<0:
        print "Please enter a number greater than or equal to 0"
    else:
        if(a==1 or a==0 ):
            print "1"
    for i in range(1,int(a)+1):
            b=b*i
    c.append(str(b))

print ",".join(c)
</code>```

the program is to find factorial, i am getting the result. If someone enters a negative number, it should not return a factorial but this does. I just want to know why is the if and else conditions getting skipped.

答:
Comparing string with number returns False as result

```<code>'-2'< 0 ---> False --> if condition will be skipped
</code>```

Convert the string to integer since factorial are only applied to integer

```<code>int('-2') < 0 ---> True --> if condition will be executed
</code>```

x = raw_input().split(" ")  returns strings data type in a list

so you can't use int for the entire list x,

only one string at the time

When invoking the if condition you are considering only one element in the list,

```<code>then convert from string to int before comparing to 0 --> int(a) < 0
</code>```

The second point is related to indentation print (",".join(c))
should be included inside the else loop

Also

```<code>if(a==1 or a==0 ):
                print "1"
</code>```

is not needed as it has been take care in the for loop below

The code is as follow

```<code>x=raw_input().split(" ")
c=[]
for a in x:
    b=1
    if int(a) < 0:
        print "Please enter a number greater than or equal to 0"
    else:
        for i in range(1,int(a)+1):
            b=b*i
        c.append(str(b))

        print ",".join(c)
</code>```

Body:
I am using an If statement inside a for loop but the If statement is getting skipped even after the condition is met

x=raw_input().split(" ")
c=[]
for a in x:
    b=1
    if a<0:
        print "Please enter a number greater than or equal to 0"
    else:
        if(a==1 or a==0 ):
            print "1"
    for i in range(1,int(a)+1):
            b=b*i
    c.append(str(b))

print ",".join(c)

the program is to find factorial, i am getting the result. If someone enters a negative number, it should not return a factorial but this does. I just want to know why is the if and else conditions getting skipped.

Body:
Comparing string with number returns False as result

'-2'< 0 ---> False --> if condition will be skipped

Convert the string to integer since factorial are only applied to integer

int('-2') < 0 ---> True --> if condition will be executed

x = raw_input().split(" ")  returns strings data type in a list

so you can't use int for the entire list x,

only one string at the time

When invoking the if condition you are considering only one element in the list,

then convert from string to int before comparing to 0 --> int(a) < 0

The second point is related to indentation print (",".join(c))
should be included inside the else loop

Also

if(a==1 or a==0 ):
                print "1"

is not needed as it has been take care in the for loop below

The code is as follow

x=raw_input().split(" ")
c=[]
for a in x:
    b=1
    if int(a) < 0:
        print "Please enter a number greater than or equal to 0"
    else:
        for i in range(1,int(a)+1):
            b=b*i
        c.append(str(b))

        print ",".join(c)


问:
Android WebView Has started crashing on Android 9
Hello Expert Android Developers:

We have an android app and our basic workflow is as below

User is sent a link via email or text message

User clicks on the link and a page open on Chrome or Android default browser and have a button named JOIN

User clicks on this JOIN button and our app is launched and a page is displayed in webview asking the User to enter the first name, last name and phone/email and then the user clicks on a button named INITIATE

We validate the information - if the user is new, we create a record, it user is existing, we update it etc and then show a popup informing that his session would be recorded.

As soon as the user clicks on OK on the popup and then the control exists the webview and the user is on a native android page.

Problem
As soon as the OK button is tapped on the webview where our native app page would launch normally until a few weeks ago, the app crashes and we would be taken back to the start of the webview page asking us to enter the details.

Please note the below caveats:

First of all, this is happening only in the case of Android 9. We have tested this on Samsung Galaxy S8 and S9. And it doesn't happen every single time but it happens rather regularly, I would say sometimes even 2 out of 3 times. In the best of the times, it has happened 2 out of 10 times but it happens.

This code has been running successfully for the past 1 year or so and we never had this problem. It has only started happening in the last 3-4 weeks.

We also have an iOS app, where the same problem is not observed.

Here is a code snippet that may help - This is how we are loading the webview.

```<code>webview = findViewById(R.id.webview);
    webview.setVisibility(View.VISIBLE);
    final ProgressDialog pd = ProgressDialog.show(ActivtyName.this, "", "Please wait", true);
    webview.setGeolocationEnabled(true);
    webview.setMixedContentAllowed(true);
    webview.getSettings().setJavaScriptEnabled(true);
    webview.getSettings().setDomStorageEnabled(true);
    webview.getSettings().setLoadWithOverviewMode(true);

    webview.setWebChromeClient(new WebChromeClient()
</code>```

=======We override a lot of methods here followed by

```<code>webview.setWebViewClient(new WebViewClient()
</code>```

=======We override methods here.

Any idea what might be going on? We have tried looking at the logs while debugging via USB mode, but we don't see much in logs except what is shown on the Android Console like below:

```<code>*** *** *** *** *** *** *** *** *** *** *** *** *** *** *** ***
pid: 0, tid: 0 >>> com.a****d.xyzapp <<<
</code>```

backtrace:

```<code>#00  pc 0000000001b61620  /data/app/com.android.chrome-DpcaMBOCm2oa08upmw1Tug==/base.apk
</code>```

Here is the more detailed log as requested:

```<code>2019-05-18 11:58:01.694 23217-23217/com.a**d.xyzapp.debug A/chromium:

[FATAL:crashpad_client_linux.cc(404)] Render process (28925)'s crash wasn't handled by all associated  webviews, triggering application crash.
Fatal signal 5 (SIGTRAP), code 1 (TRAP_BRKPT), fault addr 0x7ab7b9d620 in tid 23217 (atientapp.debug), pid 23217 (atientapp.debug) (edited)
</code>```

答:
In your case Render process is crashing and it is not killed by the system.

So as described here, if you override

```<code>onRenderProcessGone(WebView view,
            RenderProcessGoneDetail detail)
</code>```

above method then detail.didCrash() will holds true in your case. In that case, Renderer crashed because of an internal error, such as a memory access violation. The app itself crashes after detecting that the renderer crashed.

To handle the crash and allow your app to continue executing, you should follow the below steps:-

Destroy the current WebView instance.

Specify your business logic how your app can continue executing.

Override onRenderProcessGone and return true.

Problem As soon as the OK button is tapped on the webview where our
  native app page would launch normally until a few weeks ago, the app
  crashes and we would be taken back to the start of the webview page
  asking us to enter the details.

This is because if a renderer crashes while loading a particular web page, attempting to load that same page again could cause a new WebView object to exhibit the same rendering crash behaviour.

Check code in this link for more info.

Hope this will help.

Body:
Hello Expert Android Developers:

We have an android app and our basic workflow is as below

User is sent a link via email or text message

User clicks on the link and a page open on Chrome or Android default browser and have a button named JOIN

User clicks on this JOIN button and our app is launched and a page is displayed in webview asking the User to enter the first name, last name and phone/email and then the user clicks on a button named INITIATE

We validate the information - if the user is new, we create a record, it user is existing, we update it etc and then show a popup informing that his session would be recorded.

As soon as the user clicks on OK on the popup and then the control exists the webview and the user is on a native android page.

Problem
As soon as the OK button is tapped on the webview where our native app page would launch normally until a few weeks ago, the app crashes and we would be taken back to the start of the webview page asking us to enter the details.

Please note the below caveats:

First of all, this is happening only in the case of Android 9. We have tested this on Samsung Galaxy S8 and S9. And it doesn't happen every single time but it happens rather regularly, I would say sometimes even 2 out of 3 times. In the best of the times, it has happened 2 out of 10 times but it happens.

This code has been running successfully for the past 1 year or so and we never had this problem. It has only started happening in the last 3-4 weeks.

We also have an iOS app, where the same problem is not observed.

Here is a code snippet that may help - This is how we are loading the webview.

webview = findViewById(R.id.webview);
    webview.setVisibility(View.VISIBLE);
    final ProgressDialog pd = ProgressDialog.show(ActivtyName.this, "", "Please wait", true);
    webview.setGeolocationEnabled(true);
    webview.setMixedContentAllowed(true);
    webview.getSettings().setJavaScriptEnabled(true);
    webview.getSettings().setDomStorageEnabled(true);
    webview.getSettings().setLoadWithOverviewMode(true);

    webview.setWebChromeClient(new WebChromeClient()

=======We override a lot of methods here followed by

webview.setWebViewClient(new WebViewClient()

=======We override methods here.

Any idea what might be going on? We have tried looking at the logs while debugging via USB mode, but we don't see much in logs except what is shown on the Android Console like below:

*** *** *** *** *** *** *** *** *** *** *** *** *** *** *** ***
pid: 0, tid: 0 >>> com.a****d.xyzapp <<<

backtrace:

#00  pc 0000000001b61620  /data/app/com.android.chrome-DpcaMBOCm2oa08upmw1Tug==/base.apk

Here is the more detailed log as requested:

2019-05-18 11:58:01.694 23217-23217/com.a**d.xyzapp.debug A/chromium:

[FATAL:crashpad_client_linux.cc(404)] Render process (28925)'s crash wasn't handled by all associated  webviews, triggering application crash.
Fatal signal 5 (SIGTRAP), code 1 (TRAP_BRKPT), fault addr 0x7ab7b9d620 in tid 23217 (atientapp.debug), pid 23217 (atientapp.debug) (edited)

Body:
In your case Render process is crashing and it is not killed by the system.

So as described here, if you override

onRenderProcessGone(WebView view,
            RenderProcessGoneDetail detail)

above method then detail.didCrash() will holds true in your case. In that case, Renderer crashed because of an internal error, such as a memory access violation. The app itself crashes after detecting that the renderer crashed.

To handle the crash and allow your app to continue executing, you should follow the below steps:-

Destroy the current WebView instance.

Specify your business logic how your app can continue executing.

Override onRenderProcessGone and return true.

Problem As soon as the OK button is tapped on the webview where our
  native app page would launch normally until a few weeks ago, the app
  crashes and we would be taken back to the start of the webview page
  asking us to enter the details.

This is because if a renderer crashes while loading a particular web page, attempting to load that same page again could cause a new WebView object to exhibit the same rendering crash behaviour.

Check code in this link for more info.

Hope this will help.


问:
Is it possible for WCF that uses wsDualHttpBinding to be on Https?
I implemented a simple WCF/WPF project to try out the push notification function of WCF. From searches online, they are mostly implemented via callback and using the binding wsDualHttpBinding.

However, when trying to implement this PoC project into my main project. I realise the existing WCF service is using Https and I can't seem to find a way to enable transport security mode for wsDualHttpBinding as compared to the existing wsHttpBinding.

If the above problem is not solvable, is there another way to implement push notification over Https on WCF?

答:
If we want to use SSL protocol to encrypt our duplex communication, depending on the practical scenario, we could consider the following binding.

NetTcpbinding: mainly designed binding for the intranet. If the
communication is only within the LAN, we could use this binding, it
supports duplex communication and SSL protocol with a certificate.
https://learn.microsoft.com/en-us/dotnet/framework/configure-apps/file-schema/wcf/security-of-nettcpbinding

NetHttpsbinding: It is a duplex communication across the Internet
based on websocket protocol, and supports the use of certificates to
encrypt communications.

https://learn.microsoft.com/en-us/dotnet/framework/wcf/system-provided-bindings

Refer to the below example.

https://learn.microsoft.com/en-us/dotnet/framework/wcf/feature-details/how-to-create-a-wcf-service-that-communicates-over-websockets


问:
C++, I want to know how to allocate memory vector< pair<int, int> > *
I have an error _Has_unused_capacity() vector...
I don't know how to allocate dynamic memory

I try to push_back, but the error occurred

```<code>vector< pair<int, int> > * v;

void Some_Function(){
   int m=3;
   int idx1=1;
   int idx2=2;
   int idx3=3;

   for(int i = 0; i<m; i++) {
       v[idx1].push_back(make_pair(idx2, idx3));
       v[idx2].push_back(make_pair(idx1, idx3));
   }
}
</code>```

答:
You have a poiter to a vector which points to nowhere. Either allocate memory for your vector ( not recommended though) or don't use a pointer.

```<code>vector< pair<int, int> > * v = new vector<pair<int, int>>[2];
V[idx].push_back(make_pair(idx2, idx3));
</code>```

Don't forget to delete your vector when you are done with that.

```<code>delete [] v;
</code>```

The better way is using smart pointers, here is an example with shared_ptr:

```<code>#include <iostream>

#include <vector>
#include <memory>

using namespace std;
using vecPair = vector<pair<int, int>>;

// deallocator for an array of vectors
void deleter(vecPair* x)
{
    delete[] x;
}

int main() {
    shared_ptr<vecPair> v;
    v.reset(new vecPair[2], deleter);
    int a = 1;
    int b = 2;
    int c = 3;
    int d = 4;
    v.get()[0].push_back(make_pair(a, b));
    v.get()[1].push_back(make_pair(c, d));
}
</code>```

Body:
I have an error _Has_unused_capacity() vector...
I don't know how to allocate dynamic memory

I try to push_back, but the error occurred

vector< pair<int, int> > * v;

void Some_Function(){
   int m=3;
   int idx1=1;
   int idx2=2;
   int idx3=3;

   for(int i = 0; i<m; i++) {
       v[idx1].push_back(make_pair(idx2, idx3));
       v[idx2].push_back(make_pair(idx1, idx3));
   }
}

Body:
You have a poiter to a vector which points to nowhere. Either allocate memory for your vector ( not recommended though) or don't use a pointer.

vector< pair<int, int> > * v = new vector<pair<int, int>>[2];
V[idx].push_back(make_pair(idx2, idx3));

Don't forget to delete your vector when you are done with that.

delete [] v;

The better way is using smart pointers, here is an example with shared_ptr:

#include <iostream>

#include <vector>
#include <memory>

using namespace std;
using vecPair = vector<pair<int, int>>;

// deallocator for an array of vectors
void deleter(vecPair* x)
{
    delete[] x;
}

int main() {
    shared_ptr<vecPair> v;
    v.reset(new vecPair[2], deleter);
    int a = 1;
    int b = 2;
    int c = 3;
    int d = 4;
    v.get()[0].push_back(make_pair(a, b));
    v.get()[1].push_back(make_pair(c, d));
}


问:
Using Silverlight for an entire website?
We need to build an administration portal website to support our client/server application. Since we're a .Net shop the obvious traditional way would be to do that in ASP.Net. But Silverlight 2 will be coming out of beta a good while before our release date. Should we consider building the whole website in silverlight instead, with a supporting WCF backend?

The main function of the portal will be: users, groups and permissions configuration; user profile settings configuration; file upload and download for files needed to support the application.

I think the main reason for taking this approach would be that we have good experience with WPF and WCF, but little experience in ASP.Net. Either way we would have to learn ASP.Net or Silverlight, and learning Silverlight seems a more natural extension of our current skills.

Are there any big no-nos from the experience of StackOverflowers? What are the big positives?

答:
I agree with what everyone had said so far and I think this Flow Chart, which is aimed at Flash, also applies to Silverlight.

Source of Image

OwnerDisplayName: Sam

ContentLicense: CC BY-SA 2.5

LastEditorDisplayName: Sam

OwnerDisplayName: GateKiller

ContentLicense: CC BY-SA 3.0


问:
ldap_get_entries returns array with element count=zero
In some situations ldap_get_entries returns array with element count=zero, so I have an array like array('count'=>0) without any further entries.

What are the conditions for this to happen?

PS:

if the OU I am searching in is empty I am getting a different error (Invalid Base DN)

if the user doesn't have permissions to an OU I am getting the same error as above

EDIT:

the PHP code is irrelevant, since I can do all kind of searches with it and the above mentioned problem happens only in some strange Active Directory configurations

if you still insists... $entries = ldap_get_entries($this->ldap_connection, $search_result);

ldap_get_entries returns in most of the cases what I expect it to return with proper errors

So, to restate my question, what are the conditions for ldap_get_entries to return an array with count=0, without any errors. By condition I mean:

Active Directory rights and permissions

user permissions

OU permissions (aka Security tab)

any PHP related information on when this can happen

Thanks

EDIT2 - as requested, here is the rest of the code:

```<code>public function connect() {

    // connect to the server
    $this->ldap_connection = ldap_connect($this->ldap_server);
    if (!$this->ldap_connection){
        $error_message= "LDAP-Connect-Error: " . ldap_error($this->ldap_connection) . ".";
        throw new RuntimeErrorException($error_message);
    }

    // set protocol version
    if (!ldap_set_option($this->ldap_connection, LDAP_OPT_PROTOCOL_VERSION, $this->ldap_protocol_version)){
        $error_message= "LDAP-SetProtocolVersion-Error: " . ldap_error($this->ldap_connection) . ".";
        throw new RuntimeErrorException($error_message);
    }

    // set with/without referrals (limit/do not limit search on current server)
    if (!ldap_set_option($this->ldap_connection, LDAP_OPT_REFERRALS, $this->ldap_protocol_referrals)){
        $error_message= "LDAP-SetReferrals-Error: " . ldap_error($this->ldap_connection) . ".";
        throw new RuntimeErrorException($error_message);
    }

    // binding to ldap server
    if (!@ldap_bind($this->ldap_connection, $this->ldap_auth_rdn, $this->ldap_auth_pass)){
        $error_message= "LDAP-Bind-Error: " . ldap_error($this->ldap_connection) . ".";
        throw new RuntimeErrorException($error_message);
    }
}

public function search($filter,$fields){
    if (!$this->ldap_connection) {
        $this->connect();
    }

    // search the ldap
    $search_result = @ldap_search($this->ldap_connection, $this->ldap_base_distinguished_name, $filter,$fields);
    if ($search_result===false){
        $error_message= "LDAP-Error: " . ldap_error($this->ldap_connection) . ".";
        throw new RuntimeErrorException($error_message);
    }

    //Create result set
    $entries = ldap_get_entries($this->ldap_connection, $search_result);
    if ($entries === false ){
        $error_message= "LDAP-Error: " . ldap_error($this->ldap_connection) . ".";
        throw new RuntimeErrorException($error_message);
    }

    return (is_null($entries) ? array() : $entries); // http://bugs.php.net/48469
}
</code>```

答: It means what you are searching for didn't return results either because it isn't there or you aren't searching correctly for it.</p>

Body:
In some situations ldap_get_entries returns array with element count=zero, so I have an array like array('count'=>0) without any further entries.

What are the conditions for this to happen?

PS:

if the OU I am searching in is empty I am getting a different error (Invalid Base DN)

if the user doesn't have permissions to an OU I am getting the same error as above

EDIT:

the PHP code is irrelevant, since I can do all kind of searches with it and the above mentioned problem happens only in some strange Active Directory configurations

if you still insists... $entries = ldap_get_entries($this->ldap_connection, $search_result);

ldap_get_entries returns in most of the cases what I expect it to return with proper errors

So, to restate my question, what are the conditions for ldap_get_entries to return an array with count=0, without any errors. By condition I mean:

Active Directory rights and permissions

user permissions

OU permissions (aka Security tab)

any PHP related information on when this can happen

Thanks

EDIT2 - as requested, here is the rest of the code:

public function connect() {

    // connect to the server
    $this->ldap_connection = ldap_connect($this->ldap_server);
    if (!$this->ldap_connection){
        $error_message= "LDAP-Connect-Error: " . ldap_error($this->ldap_connection) . ".";
        throw new RuntimeErrorException($error_message);
    }

    // set protocol version
    if (!ldap_set_option($this->ldap_connection, LDAP_OPT_PROTOCOL_VERSION, $this->ldap_protocol_version)){
        $error_message= "LDAP-SetProtocolVersion-Error: " . ldap_error($this->ldap_connection) . ".";
        throw new RuntimeErrorException($error_message);
    }

    // set with/without referrals (limit/do not limit search on current server)
    if (!ldap_set_option($this->ldap_connection, LDAP_OPT_REFERRALS, $this->ldap_protocol_referrals)){
        $error_message= "LDAP-SetReferrals-Error: " . ldap_error($this->ldap_connection) . ".";
        throw new RuntimeErrorException($error_message);
    }

    // binding to ldap server
    if (!@ldap_bind($this->ldap_connection, $this->ldap_auth_rdn, $this->ldap_auth_pass)){
        $error_message= "LDAP-Bind-Error: " . ldap_error($this->ldap_connection) . ".";
        throw new RuntimeErrorException($error_message);
    }
}

public function search($filter,$fields){
    if (!$this->ldap_connection) {
        $this->connect();
    }

    // search the ldap
    $search_result = @ldap_search($this->ldap_connection, $this->ldap_base_distinguished_name, $filter,$fields);
    if ($search_result===false){
        $error_message= "LDAP-Error: " . ldap_error($this->ldap_connection) . ".";
        throw new RuntimeErrorException($error_message);
    }

    //Create result set
    $entries = ldap_get_entries($this->ldap_connection, $search_result);
    if ($entries === false ){
        $error_message= "LDAP-Error: " . ldap_error($this->ldap_connection) . ".";
        throw new RuntimeErrorException($error_message);
    }

    return (is_null($entries) ? array() : $entries); // http://bugs.php.net/48469
}


问:
Firing React Apollo mutation on page load
I am trying to implement email verification system in react-apollo application and running into an issue. The problem is that I want to fire a GraphQL mutation on page load when a user visits a link with a verification token. The mutation currently is fired on a button click, but I want it to happen on page load.

I tried to return the mutation from render but it sent the application into an infinite loop.

```<code>return (
            <Mutation
              mutation={VERIFY_EMAIL_MUTATION}
              variables={{ id }}
              onCompleted={() => this.setState({ userVerified: true })}
            >
              {(verifyEmail, { loading, error }) => {
                 verifyEmail();
            }
            </Mutation>
</code>```

How can I implement firing this mutation on page load?

答:
Use compose and pass it down as a function to your component. The following method allows you to pass multiple mutations/queries, you can use them where-ever you want without and with triggers.</p>

```<code>import React from "react";
import { compose, graphql } from "react-apollo";

import {
  VERIFY_EMAIL_MUTATION
} from "../GraphqlQueries/ServerQueries";

class YourComponent extends React.Component {
  componentWillMount() {
    this.props.verifyEmail({variables: {email: "your_email", variable2: "variable2" }});
  }

  render() {
    return (
      <React.Fragment>
        Your Render
      </React.Fragment>
    );
  }
}

export default compose(
  graphql(VERIFY_EMAIL_MUTATION, {
    name: "verifyEmail"
  })
)(YourComponent);
</code>```

Body:
I am trying to implement email verification system in react-apollo application and running into an issue. The problem is that I want to fire a GraphQL mutation on page load when a user visits a link with a verification token. The mutation currently is fired on a button click, but I want it to happen on page load.

I tried to return the mutation from render but it sent the application into an infinite loop.

return (
            <Mutation
              mutation={VERIFY_EMAIL_MUTATION}
              variables={{ id }}
              onCompleted={() => this.setState({ userVerified: true })}
            >
              {(verifyEmail, { loading, error }) => {
                 verifyEmail();
            }
            </Mutation>

How can I implement firing this mutation on page load?

Body:
Use compose and pass it down as a function to your component. The following method allows you to pass multiple mutations/queries, you can use them where-ever you want without and with triggers.

import React from "react";
import { compose, graphql } from "react-apollo";

import {
  VERIFY_EMAIL_MUTATION
} from "../GraphqlQueries/ServerQueries";

class YourComponent extends React.Component {
  componentWillMount() {
    this.props.verifyEmail({variables: {email: "your_email", variable2: "variable2" }});
  }

  render() {
    return (
      <React.Fragment>
        Your Render
      </React.Fragment>
    );
  }
}

export default compose(
  graphql(VERIFY_EMAIL_MUTATION, {
    name: "verifyEmail"
  })
)(YourComponent);


问:
How to trim only white space but not \n in Java
I have a string like

String str = " hello world\n "

when I call str.trim(),
it returns

"hello world"

However, I need the string looks like

"hello world\n"

How could I do it for only remove leading and trailing white space in a string?

答:
You can use a regular expression with the character to remove.

Here's a pretty simple code that works.

```<code>String s = "  Hello world\n      ";
System.out.println(s);
System.out.println(s.replaceAll("(^ +)|( +$)", ""));
</code>```

Output

```<code>  Hello world\n
Hello world\n
</code>```

Body:
You can use a regular expression with the character to remove.

Here's a pretty simple code that works.

String s = "  Hello world\n      ";
System.out.println(s);
System.out.println(s.replaceAll("(^ +)|( +$)", ""));

Output

  Hello world\n
Hello world\n