Blocked installation when debugging app by Android Studio

Asked

Viewed 498 times

4

When trying to debug or install an application I am developing, the following message appears on the device where the APK is being installed.

Blocked installation.

This app contains code created with the intention of circumventing Android security protections.

This started happening out of the blue, I had to delete the project and check out again by SVN, and redo what had changed, worked at first, but now after any change in the code, this error appears again.

This project is already pretty big, just over a year of development.

I haven’t found any similar case on the Internet, I hope someone can help me with that.

Permissions used by the app:

<uses-permission android:name="android.permission.CAMERA" />
<uses-permission android:name="android.permission.VIBRATE" />
<uses-permission android:name="android.permission.FLASHLIGHT" />
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.CHANGE_WIFI_STATE" />
<uses-permission android:name="android.permission.ACCESS_WIFI_STATE" />
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<uses-permission android:name="android.permission.DOWNLOAD_WITHOUT_NOTIFICATION" />
<uses-permission android:name="android.permission.READ_PHONE_STATE" />
<uses-permission android:name="android.permission.WAKE_LOCK" />
<uses-permission android:name="com.google.android.c2dm.permission.RECEIVE" />
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />

<permission
    android:name="br.com.empresa.projeto.permission.C2D_MESSAGE"
    android:protectionLevel="signature" />

<uses-permission android:name="br.com.empresa.projeto.permission.C2D_MESSAGE" />

build.Gradle

apply plugin: 'com.android.application'

android {
    compileSdkVersion 23
    buildToolsVersion "23.0.1"
    defaultConfig {
        applicationId "br.com.empresa.projeto"
        minSdkVersion 21
        targetSdkVersion 23
        versionCode 2
        versionName "2.6"
        testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
        multiDexEnabled true
    }
    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
        }
    }
    useLibrary 'org.apache.http.legacy'
}

dependencies {
    compile fileTree(dir: 'libs', include: ['*.jar'])
    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:23.4.0'
    compile 'com.android.support.constraint:constraint-layout:1.0.0-alpha4'
    compile 'com.android.support:design:23.4.0'
    compile files('libs/androidasync-2.1.3.jar')
    compile files('libs/ion-2.1.3.jar')
    compile files('libs/gson-2.4.jar')
    compile files('libs/picasso-2.5.2.jar')
    compile files('libs/generalscan_sdk.jar')
    compile 'com.google.android.gms:play-services:7.5.+'
    compile 'com.android.support:multidex:1.0.1'
    compile files('libs/core-3.2.0.jar')
    testCompile 'junit:junit:4.12'
}

An interesting detail, this started shortly after integrating Android Studio to SVN, before using the tool Tortoisesvn.

  • the android version on the device is 23 or higher?

  • no, it’s 21, but I use some libraries from 23. google itself creates projects that way.

  • If you don’t find a solution, be sure to report the problem to the android development team. It may not seem, but it helps a lot, I went through problems and sent a very detailed feedback, already in the next version, they had solved, I do not know if this is the case, but it is the tip.

  • Value by tip, I will do this, the problem was in the apk generated from an existing one, to solve simply delete the apk before compiling again so that a new one was created. However this error does not occur to me anymore, maybe have already fixed it.

  • Remove the permissions from your manifest and try to detect if any of them cause the error. Then try doing this with Gradle. Go in pieces until you find the cause.

2 answers

1

I believe that in addition to enabling USB debugging, you should enable the option: Unknown sources, accessing the Settings Menu and going to Security on your device.

  • This would be my last alternative, it is used only by the company and we have 60 devices running this app, it is kind of impossible to do this at all, even because some in Brazil are not. The strange thing is that it had never happened, and out of nowhere it started to happen.

0

Fala Heris,

Looking at your code, I believe what you’re blocking is this:

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

What is the function of it? You tried to take and compile?

And I noticed too, that you’re putting the .jar libs, tries to put the Gradle link, for example:

instead of:

compile files('libs/picasso-2.5.2.jar')

tries to put:

compile 'com.squareup.picasso:picasso:2.5.2'

Hugs.

  • I had already withdrawn this permission and even so it didn’t work, I tried to switch to the Gradle link as you said but it also didn’t work.

Browser other questions tagged

You are not signed in. Login or sign up in order to post.