简体   繁体   中英

Android Studio builds a debug apk but doesn't deploy/run on device

I'm struggling with coming to terms with Andoid Studio after years working with Eclipse. I've imported an existing Eclipse simple project into AStudio 1.1.0 and altough it builds an APK

Directory of C:\\dev\\projects\\AndroidStudio\\DiddyOsmdroid\\TinyOsmdroid\\build\\out puts\\apk

25/02/2015 17:02 176,517 TinyOsmdroid-debug-unaligned.apk

25/02/2015 17:02 176,518 TinyOsmdroid-debug.apk

It doesn't deploy to a tablet connected via USB. (It did the first time I tried it, but not now) I've edited the run configurations to try both 'USB' and 'choose'. I try to deploy and run by double clicking assembleDebug as suggested in the docs. The device is visible in the Android window, in that Log lines are shown.

My gradle file looks like:

apply plugin: 'com.android.application'

android {
    compileSdkVersion 7
    buildToolsVersion "21.1.2"

    defaultConfig {
        applicationId "osmdemo.demo"
        minSdkVersion 3
        targetSdkVersion 3
    }
    signingConfigs {
        release {
            storeFile file("c:/users/me/some.keystore")
            storePassword "xxxxxxxxxxx"
            keyAlias "some_alias"
            keyPassword "yyyyyy"
        }
    }

    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.txt'
            signingConfig signingConfigs.release
        }
    }
}

dependencies {
    compile files('libs/osmdroid-android-4.1.jar')
    compile files('libs/slf4j-android-1.5.8.jar')
}

I'd be grateful to get any suggestions.

Gradle wont excute the app on the emulator/device. It will only build and install. You have to run an adb command to run the app. This is essentially what the Run button on Android Studio does for you.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM