I Have started my new android project with Basic Default Activity.IT run fine in emulator .I Have tried to install iy in real device both pre lolipop and abovr lolipop device but getting error
App cannot be installed error in prelolipop device and above lolipop device app will install but when i try to open app it will close
Can any one help how to fix this issue ?
Build.gradle
apply plugin: 'com.android.application'
android {
compileSdkVersion 26
buildToolsVersion "26.0.1"
defaultConfig {
applicationId "com.example.myapp.myapplication"
minSdkVersion 14
targetSdkVersion 26
versionCode 1
versionName "1.0"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
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:26.+'
compile 'com.android.support.constraint:constraint-layout:1.0.2'
testCompile 'junit:junit:4.12'
}
Your code is fine, my guess is that your APK is not completely built
Build your APK:
On Android Studio click on Build
Then click on Build APK(s)
After that search for your debug APK and install it on your device
If this fails you can try ADB, take a look at the following guides for install and usage:
How to install it on windows
How to Install apk using ADB
Hope it helps
Two things could be the problem.
Navigate to settings > security and make sure Unknown sources is checked.
Make sure you downloaded the whole apk in the email
Hope this helps!
Related
I have a strange problem that just started with an existing Android Studio 2.3.3 project.
The build process is not automatically generating an APK, in this case app-debug.apk Log shows build is successful, but no APK anywhere in the project directory tree. Manually selecting Build / Build APK works fine, however.
This is a problem when I change the source and click run. The build process is successful, but then get "Error Installing APK" into the emulator (because the APK does not exist).
This problem only happens on the one project, and I was playing around with Espresso earlier. My guess is I changed a setting somewhere, I just cannot figure out which one. What do I need to change to have the APK generated automatically again? build.gradle included.
apply plugin: 'com.android.application'
android {
compileSdkVersion 25
buildToolsVersion "25.0.3"
defaultConfig {
applicationId "com.example.myapp"
minSdkVersion 16
targetSdkVersion 25
versionCode 2
versionName "0.0.2"
vectorDrawables.useSupportLibrary = true
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}
signingConfigs {
release {
storeFile file("/home/user/keystore/keystore.jks")
storePassword "xxxxxxxxxxxxxxxxxx"
keyAlias "xxxxxxxxxxxxxxxxx"
keyPassword "xxxxxxxxxxxxxxxxxxx"
}
}
buildTypes {
release {
minifyEnabled true
shrinkResources true
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
signingConfig signingConfigs.release
}
}
lintOptions {
abortOnError false
}
}
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:25.3.1'
compile 'com.android.support.constraint:constraint-layout:1.0.2'
compile 'com.google.android.gms:play-services-ads:10.2.4'
compile 'com.google.android.gms:play-services-location:10.2.4'
testCompile 'junit:junit:4.12'
}
Try below solution -
At right side of Android studio you have a gradle option click on that and then click the refresh icon and then check build.
More details follow below link -
apk not generating
My Android Studio does it all the time so I came up with a workaround. Instead of going to Build > Build APK. I simply run the app.
After running the app if you go to build > output > apk in your project directory, you will find your APK over there. Android Studio rarely throws an error when you run the app.
EDIT
This APK does NOT work on physical devices I dont know what the reason is. It runs on emulators though.
Something is not right with the key, maybe it is not on the path... A studio does not report anything then (simply does not build bundle). Click on the folder icon in the key alias field it will be an error if the key is not on the path (fastest check).
Due to many dependencies in Build.gradle android studio takes too much time and then said Request time out. So have a look into Build.gradle.
Do these steps.
First Method: try to minimize the dependencies
Second Method: Add MultiDEX implementation 'androidx.multidex:multidex:2.0.1' this is for androidX.
Third Method: Make class public class ApplicationDelegate extends MultiDexApplication { } then add in Android Manifest File like this in Application tag
<application
android:name=".ApplicationDelegate"
android:allowBackup="false"
android:icon="#mipmap/ic_launcher"
android:label="#string/app_name"
android:supportsRtl="true"
android:theme="#style/AppTheme"
tools:ignore="AllowBackup,GoogleAppIndexingWarning">
I am facing a horrified error. After installing android studio 2.2.3, i couldn't build my very first project due to gradle error. I even tried using maven link but i use my PC offline. The following is my gradle script:
apply plugin: 'com.android.application'
android {
compileSdkVersion 25
buildToolsVersion "25.0.2"
defaultConfig {
applicationId "com.example.samim.myapplication"
minSdkVersion 17
targetSdkVersion 25
versionCode 1
versionName "1.0"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
androidTestCompile fileTree(include: ['*.jar'], dir: 'libs')
androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', {
exclude group: 'com.android.support', module: 'support-annotations'
})
androidTestCompile 'com.android.support:appcompat-v7:25.1.1'
testCompile 'junit:junit:4.12'
}
I am also posting an image regarding the errors.
After doing clean build and rebuild
project gradle
I tried using maven link but i use my PC offline
That's your problem.
Gradle uses the exact same sources as Maven would.
Once you get online, your dependencies should resolve from any "New Project" in Android Studio. You then should let the dependencies download, and then you are welcome to work offline.
Note: You also need to download the Android SDK
The best solution is to add untrusted server certificates automatically to android studio when using the internet from workplace. Go to Settings -> Tools -> Server Certificates, now check "Accept non-trusted certificates automatically". After this coding can be done offline.
Also using a third party VPN solves certificate issues.
It's my code sample. When I firstly build my code, it results in so-called dex error. I added multiDexEnabled property to my gradle setting, but it results in java heap memory overflow. I increased its max size, and finally got builded. However, another error occurred...... what is the problem? android adk version?
apply plugin: 'com.android.application'
android {
compileSdkVersion 24
buildToolsVersion "24.0.2"
defaultConfig {
applicationId "belobster.earthquakealert"
minSdkVersion 14
targetSdkVersion 24
versionCode 1
versionName "1.0"
multiDexEnabled true
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
dexOptions {
javaMaxHeapSize "2g"
}
}
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
testCompile 'junit:junit:4.12'
compile 'com.android.support:appcompat-v7:24.2.1'
compile 'com.google.android.gms:play-services:9.6.1'
}
emulator image.
Check whether play services is available on the emulator, you should consider using physical device for these kind of testing purposes since maps require location services quite often.
download gapps-lp-20141109-signed and install in genymotion
If you want to test it into Genymotion only then , Genymotion provide support for play service
So please check it. It's work for me.
Thank you.
I just installed the latest version of Android Studio, my computers OS is Windows 10 x64.
The problem is that for some reason Android Studio wont hit the breakpoints.. no matter if I use my nexus 10 with USB-debugging enabled, or if I use a VM.. however.. the app gets "published" to the selected device and launched.
This is my build.gradle:
apply plugin: 'com.android.application'
android {
compileSdkVersion 23
buildToolsVersion "23.0.2"
defaultConfig {
applicationId "com.xxxx.xxxx"
minSdkVersion 21
targetSdkVersion 23
versionCode 1
versionName "1.0"
}
buildTypes {
release {
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
debug {
minifyEnabled false
debuggable true
}
}
}
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
testCompile 'junit:junit:4.12'
compile 'com.android.support:appcompat-v7:23.1.1'
}
Any ideas?
I have Unity3D installed on the same machine but there is currently no process thats associated with Unity3D running.. and adb devices do list the connected device(s)..
I have also tried to run adb kill-server and adb start-server.. but that didnt do it either..
Br,
Inx
I am trying to make an ANDROID APP that sends data from phone to the SQL Database at the Azure Cloud.
I have followed, as close as possible,the tutorials given on
https://azure.microsoft.com/en-us/documentation/articles/mobile-services-dotnet-backend-android-get-started/
First Off All, I have a little bit confusion Regarding creating an .APK file in android studio.
Here, I have assumed my .apk is in \app\build\outputs.
Now, I am trying to run app-debug.apk on my REDMI 1s Android Version 4.3 JLS36C, the app simply opens and Vanishes away. I Also tried to run it on Samsung Galaxy Note-3 Neo (SM-N750) Android Version:Android 4.4.2
When I try to run the app on the emulator itself, it is running. But not on Phones. What to do? Here is my build.gradle File
apply plugin: 'com.android.application'
android {
compileSdkVersion 20
buildToolsVersion "19.1.0"
defaultConfig {
applicationId "com.example.zumoappname"
minSdkVersion 8
targetSdkVersion 20
versionCode 1
versionName "1.0"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
repositories {
flatDir {
dirs 'aars'
}
}
}
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
compile 'com.google.code.gson:gson:2.3'
compile 'com.google.guava:guava:18.0'
compile 'com.microsoft.azure:azure-mobile-services-android-sdk:2.0.2'
compile (group: 'com.microsoft.azure', name: 'azure-notifications-handler', version: '1.0.1', ext: 'jar')
}
Please Help!
Try setting breakpoints in the onCreate method and step through the code so you can find out where the code is failing.
Another issue I have run into is device failures when a network connection is not actually available.
But definitely try to find out what line of code is failing...