Category Archives: StackOverFlow

Stack Overflow is a question and answer site for professional and enthusiast programmers.

Error while inserting Jar File in Android Studio

I am adding jar file of realm to my android project and its giving this error:

Error:Execution failed for task ':app:packageAllDebugClassesForMultiDex'.
  java.util.zip.ZipException: duplicate entry: io/realm/DefaultRealmModule.class

My Gradle File:

apply plugin: 'com.android.library'

android {
    signingConfigs {
    }
    compileSdkVersion 19
    buildToolsVersion "22.0.1"
    defaultConfig {
        minSdkVersion 11
        targetSdkVersion 19
        versionCode 1
        versionName "1.0"
    }
    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
    }
    compileOptions {
        sourceCompatibility JavaVersion.VERSION_1_7
        targetCompatibility JavaVersion.VERSION_1_7
    }
}

dependencies {
    compile 'com.j256.ormlite:ormlite-android:4.48'
    compile 'com.j256.ormlite:ormlite-core:4.48'
    compile files('libs/fat.jar')
    compile files('libs/lifesense_ble_v3.2.3.jar')

    compile 'com.google.android.gms:play-services:4.2.42'
    compile 'com.google.code.gson:gson:2.3.1'
    compile files('libs/realm-0.82.2.jar')
}

read more

Error while inserting Jar File in Android Studio

I am adding jar file of realm to my android project and its giving this error:

Error:Execution failed for task ':app:packageAllDebugClassesForMultiDex'.
  java.util.zip.ZipException: duplicate entry: io/realm/DefaultRealmModule.class

My Gradle File:

apply plugin: 'com.android.library'

android {
    signingConfigs {
    }
    compileSdkVersion 19
    buildToolsVersion "22.0.1"
    defaultConfig {
        minSdkVersion 11
        targetSdkVersion 19
        versionCode 1
        versionName "1.0"
    }
    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
    }
    compileOptions {
        sourceCompatibility JavaVersion.VERSION_1_7
        targetCompatibility JavaVersion.VERSION_1_7
    }
}

dependencies {
    compile 'com.j256.ormlite:ormlite-android:4.48'
    compile 'com.j256.ormlite:ormlite-core:4.48'
    compile files('libs/fat.jar')
    compile files('libs/lifesense_ble_v3.2.3.jar')

    compile 'com.google.android.gms:play-services:4.2.42'
    compile 'com.google.code.gson:gson:2.3.1'
    compile files('libs/realm-0.82.2.jar')
}

read more

CSRF protection in depth

I currently add a CSRF token protection mechanism to my php application.
As I read, the only requirement is a unique per-user token, which I generate using random_bytes in php7.

My concern is, if the attacker sends a http request using the user’s browser, won’t the browser send the session variable of the token in anyway? (because the user has the sessionid associated with the token).

I store the token inside a hidden value echo’d from the session variable.

For example: my token is stored inside a session variable and then the attacker sends me to a change password page with csrf protection, the validation will not pass? (I already have the correct session identifier in my browsers cookies).

read more

CSRF protection in depth

I currently add a CSRF token protection mechanism to my php application.
As I read, the only requirement is a unique per-user token, which I generate using random_bytes in php7.

My concern is, if the attacker sends a http request using the user’s browser, won’t the browser send the session variable of the token in anyway? (because the user has the sessionid associated with the token).

I store the token inside a hidden value echo’d from the session variable.

For example: my token is stored inside a session variable and then the attacker sends me to a change password page with csrf protection, the validation will not pass? (I already have the correct session identifier in my browsers cookies).

read more

Error while inserting Jar File in Android Studio

I am adding jar file of realm to my android project and its giving this error:

Error:Execution failed for task ':app:packageAllDebugClassesForMultiDex'.
  java.util.zip.ZipException: duplicate entry: io/realm/DefaultRealmModule.class

My Gradle File:

apply plugin: 'com.android.library'

android {
    signingConfigs {
    }
    compileSdkVersion 19
    buildToolsVersion "22.0.1"
    defaultConfig {
        minSdkVersion 11
        targetSdkVersion 19
        versionCode 1
        versionName "1.0"
    }
    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
    }
    compileOptions {
        sourceCompatibility JavaVersion.VERSION_1_7
        targetCompatibility JavaVersion.VERSION_1_7
    }
}

dependencies {
    compile 'com.j256.ormlite:ormlite-android:4.48'
    compile 'com.j256.ormlite:ormlite-core:4.48'
    compile files('libs/fat.jar')
    compile files('libs/lifesense_ble_v3.2.3.jar')

    compile 'com.google.android.gms:play-services:4.2.42'
    compile 'com.google.code.gson:gson:2.3.1'
    compile files('libs/realm-0.82.2.jar')
}

read more