简体   繁体   中英

A basic hello world android app not running

I am using android studio 2.3.3 to develop android apps. Today I created one project. When I configured it with just one activity, ie mainactivity and tried this app on my real device using USB debugging, it was running.

Then I shared that APK through shareit to my another device of API 26. Then it gave me error: Unfortunately app stopped working.

My app gradle config. is also updated. ie

compileSdkVersion 26
buildToolVersion 26.0.2
minSdkVersion 21
targetedSdkVersion 26

Also, I haven't defined any permission in manifest file.

This app doesn't have any complex code. It is just displaying a textview in mainactivity.

But I have experienced one thing. When I use USB debugging on my API 26 device, and run the app, the app works perfectly.

But if I use signed APK file to run it on API 26, it doesn't work.

Your shared APK is build for your device configuration. To share APK you need to build either Using Build APK option or Generate Signed APK option.

To build APK go in Build Option -> Build APK option.

You will get the app-debug.apk inside app->build->outputs->app-debug.apk

Share this APK File to everyone and enjoy.

Try using gradle version 2.2.3 ,in your Project level gradle file, when you want to share application.There is some error in gradle version 2.3.3.

dependencies {
        classpath 'com.android.tools.build:gradle:2.2.3'
    }

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