Android Studio Canary 2.4 errors

I have updated Android Studio to the new version of Canary and I updated the gradle file. When I run my application through run, I get the following error:

Process: io.github.siddharthvenu.saltanalysis, PID: 23244
java.lang.SecurityException: Signature check failed for io.github.siddharthvenu.saltanalysis
    at android.os.Parcel.readException(Parcel.java:1915)
    at android.os.Parcel.readException(Parcel.java:1861)
    at com.google.android.gms.common.internal.zzv$zza$zza.zza(Unknown Source:41)
    at com.google.android.gms.common.internal.zzf.zza(Unknown Source:0)
    at com.google.android.gms.internal.zzzf$zzc.zzxQ(Unknown Source:0)
    at com.google.android.gms.internal.zzzf$zzf.run(Unknown Source:0)
    at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:457)
    at java.util.concurrent.FutureTask.run(FutureTask.java:266)
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1162)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:636)
    at com.google.android.gms.internal.zzabx.run(Unknown Source:7)
    at java.lang.Thread.run(Thread.java:764)

Edit: I found that the above error was caused AdViewfor Android. Somehow, including the ads in my application, it is crashing.

I thought it was possible because I did not sign apk, so I signed it ( debug), and then tried to install it using the command adb install. I got the following result:

Failed to install alpha_test_006.apk: Failure [INSTALL_FAILED_TEST_ONLY: installPackageLI]

My AndroidManifest:

<?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="io.github.siddharthvenu.saltanalysis">

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

    <application
        android:allowBackup="true"
        android:hardwareAccelerated="false"
        android:icon="@mipmap/ic_material_chemical"
        android:label="@string/app_name"
        android:supportsRtl="true"
        android:theme="@style/AppTheme"
        tools:ignore="AllowBackup">
        <activity android:name=".HomeActivity">
            <intent-filter>
                <action android:name="android.intent.action.MAIN" />

                <category android:name="android.intent.category.LAUNCHER" />
            </intent-filter>
        </activity>
        <activity
            android:name=".RadicalListActivity"
            android:parentActivityName=".HomeActivity"
            android:theme="@style/AppTheme.TranslucentActionBar"
            android:screenOrientation="sensorPortrait"
            tools:targetApi="jelly_bean" />
        <activity
            android:name=".DisplayRadicalActivity"
            android:parentActivityName=".RadicalListActivity"
            android:configChanges="keyboardHidden|orientation|screenSize"
            tools:targetApi="jelly_bean" />
        <activity
            android:name=".GroupSeparationActivity"
            android:parentActivityName=".HomeActivity"
            android:screenOrientation="sensorLandscape"
            tools:targetApi="jelly_bean" />
        <activity
            android:name=".LongProcedureActivity"
            android:label="Long Procedure"
            tools:targetApi="jelly_bean"/>
    </application>

</manifest>

My build.gradle:app:

apply plugin: 'com.android.application'
android {
    compileSdkVersion 'android-O'
    buildToolsVersion '26.0.0-rc1'

    def versionPropsFile = file('version.properties')
    def code = 1
    if (versionPropsFile.canRead()) {
        Properties versionProps = new Properties()

        versionProps.load(new FileInputStream(versionPropsFile))
        List<String> runTasks = gradle.startParameter.getTaskNames();
        def value = 0
        for (String item : runTasks)
            if (item.contains("assembleRelease")) {
                value = 1
            }
        code = versionProps['VERSION_CODE'].toInteger() + value

        versionProps['VERSION_CODE'] = code.toString()
        versionProps.store(versionPropsFile.newWriter(), null)

        defaultConfig {
            applicationId "io.github.siddharthvenu.saltanalysis"
            minSdkVersion 15
            targetSdkVersion 'O'
            versionCode code
            versionName "1.0 Alpha"
            testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
        }
    } else {
        throw new FileNotFoundException("Could not read version.properties!")
    }
    buildTypes {
        release {
            minifyEnabled true
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
            signingConfig getSigningConfig()
            def str_ver
            if ((int) (code / 100) != 0) {
                str_ver = String.valueOf(code)
            } else if ((int) (code / 10) != 0) {
                str_ver = "0" + String.valueOf(code)
            } else {
                str_ver = "00" + String.valueOf(code)
            }
            applicationVariants.all { variant ->
                variant.outputs.each { output ->
                    output.outputFile = new File(output.outputFile.parent,
                            output.outputFile.name.replace(output.outputFile.name, "alpha_test_" + str_ver + ".apk")
                    )
                }
            }
        }
    }
}
dependencies {
    compile fileTree(include: ['*.jar'], dir: 'libs')
    androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', {
        exclude group: 'com.android.support', module: 'support-annotations'
    })
    compile 'com.android.support:appcompat-v7:26.0.0-alpha1'
    compile 'com.android.support:cardview-v7:26.0.0-alpha1'
    compile 'com.android.support:recyclerview-v7:26.0.0-alpha1'
    compile 'com.android.support:design:26.0.0-alpha1'
    compile 'com.github.manuelpeinado.fadingactionbar:fadingactionbar-abc:3.1.2'
    compile 'com.google.firebase:firebase-core:10.0.1'
    compile 'com.google.firebase:firebase-ads:10.0.1'
    compile 'com.jaredrummler:material-spinner:1.1.0'
    compile 'com.google.code.findbugs:jsr305:2.0.1'

    testCompile 'junit:junit:4.12'
    compile files('libs/YouTubeAndroidPlayerApi.jar')
}

apply plugin: 'com.google.gms.google-services'
+6
source share
1 answer

SecurityException, . AdView. , . , , AdView.

adb install ,

0

Source: https://habr.com/ru/post/1016024/


All Articles