I tried to debug a release version of my Android application but Android Studio failed to attach a debugger. (It could not find Android procces of my running application).
Under devices console, there was only a message:
No debuggable applications
You also should have Tools->Android->Enable ADB Integration active.
The solution is to turn on debuggable flag (debuggable true) in application's gradle file:
apply plugin: 'com.android.application'
android {
compileSdkVersion 19
buildToolsVersion "20.0.0"
defaultConfig {
applicationId "org.example"
minSdkVersion 14
targetSdkVersion 19
versionCode 1
versionName "1.0"
}
buildTypes {
debug {
debuggable true
}
}
}
After Android Studio synced Gradle with project files and reinstalled an application, the debugging start working.
Just click the "Bug" icon and you will be good to go.
I had the same problem and that did the trick.
hope it helps someone.
if intellij or AS you should make sure your Build Variants Setting is debug.
Check if Tools->Android->Enable ADB Integration is enabled.
Also disable and re-enabling it works most of the times.
I want to add one point to above 2 answers :
If Eclipse IDE is running parallel to Android Studio then above answers may not help you. The debuggable application will not refresh event after setting debuggable true in Gradle file.
So, close Eclipse IDE and check in Android Studio. The debuggable application will refresh.
Thank you
Believe it or not,a faulty USB cable can cause this problem to linger even if you follow all the suggestions here.Changing my USB cord did it for me
It happen to me when I wanted to debug my app after I Generated a Sign APK, so I had to change back the Build Variants value from release to debug.
Multiple Options to do this:
1.Tools->Android->Enable ADB Integration
OR
2.Build->Clean Project , the Build-> Rebuild Project. Then "adb kill-server" and "adb start-server"
One of above will work.
You should check also in your AndroidManifest.xml file that there is no option like android:debuggable="false" in your application tag.
<application
android:icon="#drawable/icon"
android:label="#string/app_name"
android:debuggable="false">
To make it work just remove this option.
Ctrl+shift+A
Type Enable ADB Integration
click on toggle
Done
This is the problem I encountered.The AAR file you import may change the attribute of debuggable, So just remove the debuggable attribute in your Main App Manifest file.
See the picture:
Working solution
1.For testing run as debug if everything is correct process is attached and you can able to debug.Can see in the list
2.If it says application not debuggable then alter gradle
Repeat step 1
4 .If not toggle Tools->Android->Enable ADB Integration and make it enabled.
5.Restart adb server
6.Dis connect and connect device It will list
Believe it or not, if you are on Windows OS, region setting has something to do with this too.
make sure your Regional Format is on English (United States) or actually any setting which makes your Calendar non-unicode (e.g. not On Persian Calendar or Arabic ...)
Apparently someone in Android Studio or ADB Dev team used .toString() with no respect to culture somewhere in their code !
Click the green bug, but make sure the drop down is set to app, if not it will not deploy your app, and just say something about.
Connected to the target VM, address: 'localhost:xxx', transport:
'socket'
Make sure your build variant is set to "debug". And debug has debuggable true on your build.gradle file
I used Mac to run Android Studio. I agree with #Kushal, I did not open Eclipse though.
I shut off Parallels Desktop and other APPs which may use the same Gradle.
Related
I have a Flutter project in Android Studio. I am planning to migrate to AndroidX. Whenever I do Refactor -> Migrate to AndroidX, Android Studio shows error message:
You need to have compileSdk set to at least 28 in your module build.gradle to migrate to AndroidX.
However I have already set the compileSdkVersion 28 in my app/gradle.build file.
Is there anything else I need to do?
I was able to resolve my issue:
Open the Flutter project into Android Studio
Right click on the android directory, click on Flutter -> Open Android module in Android Studio. It asked me to upgrade my gradle plugin.
Then I installed Google Play Services. Tools -> SDK Manager -> SDK Tools and check the Google Play Services.
After the Google Play Services Installed, I did Refactor -> Migrate to AndroidX.
It started working.
Note: Do the refactor from the project window you opened in the step 2.
Here is how I got rid of "compileSdkVersion 28" error. But before I solved it this way, I upgraded Android Studio IDE from 3.4.1 -> 3.5.1. I am not sure if this was really needed. So whatever version of IDE you have, see if you can use following steps to solve it.
Go to "Project Structure" - (2nd icon on left of AVD Manager icon on top right corner of IDE)
On "Project Structure" dialog under left navigation click on Project Settings->Modules
After selecting Modules, on the right pane you should see 3 tabs Sources, Paths, Dependencies
Click on Dependencies, if you are getting compileSdkVersion 28 error the SDK version under Dependencies is pointing to version lower than 28 -> Select 28 or higher
5. Click OK
Now Refactor->Migrate to AndroidX worked for me
In gradle.build (app) add this
compileSdkVersion 28
defaultConfig {
......
minSdkVersion 21
targetSdkVersion 28
......
}
And there are some implementations required to use androidx :-
implementation 'androidx.appcompat:appcompat:1.1.0-alpha01'
implementation 'androidx.legacy:legacy-support-v4:1.0.0'
And add these given two lines(below) to gradle.properties:-
android.useAndroidX=true
android.enableJetifier=true
I'm having exact same problem. Been trying to migrate since all the new firebase stuff is forcing it, but the current guides to upgrade are sparse. First I was trying on a backup of my project with a lot of addons and kept getting that error, then I created a brand new flutter project with all the latest (dev channel), followed every step, checked every detail, read every forum, but still getting "You need to have compileSdk set to at least 28 in your module build.gradle to migrate to AndroidX."...
Matched the steps from https://androidxhackathon.blogspot.com/2018/05/refactor-to-android-x.html too and can't get it to refactor right.
Even went to File>ProjectStructure>Project SDK and set to Android API 28 Platform.
Anyone know what we might be missing? Did you have any luck Sam?
Click on Invalidate cache/Restart from file option worked for me
Try replacing the default in dependencies {...} in app/build.gradle with this:
dependencies {
testImplementation 'junit:junit:4.12'
androidTestImplementation 'androidx.test:runner:1.1.0-alpha4'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.1.0-alpha4'
}
The replacement is similar to what is posted in the "Not recommended..." section from this link: https://flutter.dev/docs/development/packages-and-plugins/androidx-compatibility
If you can explain why this works, please add a comment. Thank you!
Go to "Project structure" in the Files menu. Clear out every issue you see there, like
set the android sdk, fix the problems specified
A simple solution.
follow the steps.
Create a new app --> (tick androidX in the window) --> finish
Add some lines in the android --> app --> build.gradle as follow,
update the defaultConfig
minSdkVersion 19
targetSdkVersion 28
multiDexEnabled true
Go to Refractor --> migrateToAndroidx
Do Flutter clean
Restart
Run
hope it works now ...
i am testing my code but i have a problem, when i try to run the "Debug" process my cell phone get stock on Waiting For Debugger screen and i have to use Attach Debugger to Android Process on Android Studio, it used to attach automatically but i have been changing my android studio configuration, if there any way to make it automatic again i tried i lot but i can't find it?
Try toggling Tools-> Android -> Enable ADB Integration off and on, I had this issue when switching to the beta 2 of Android Studio 3. This helped me solving the issue.
I'm using Android Studio, and I'm trying to add the slf4j library using
Build/Edit Libraries and Dependencies.
I clicked on the +, selected Library Dependency, and picked slf4j from the list. Studio added the library to my build.gradle file like this:
dependencies {
compile 'com.android.support:support-v4:24.1.1'
compile 'org.slf4j:slf4j-android:1.7.7'
...
But when I try to run sync, I get this error:
Error:(75, 10) Failed to resolve: org.slf4j:slf4j-android:1.7.7
Is there something else I need to do to my project to be able to use this library??
Turns out what was causing this issue for me (and likely for you, given the build file above) was the Scala plugin. There was a bug with the Scala plugin preventing Android Studio from importing Gradle projects. The fix for this has already been pushed live, so to get Android Studio working again you can either disable the Scala plugin or update it.
Open Settings/Preferences
Open the Plugins section on the left
Find the Scala plugin
Right click on the plugin and click Reload List of Plugins
Right click on the plugin again and click Update Plugin
This allowed me to do a Gradle sync and build from Android Studio again, I hope it helps for you!
It looks like this is a bug with Android Studio. Hopefully it'll be fixed soon.
In the meantime, you can debug your application without launching it from Android Studio by attaching the debugger to a running process of the application. You can do this two ways.
Via the menus: Run -> Attach Debugger to Android Process
Pressing the button that is two to the right of the play/build button. It looks like a grey phone/rectangle with a little green bug in the bottom right
After you do this, a dialog will show up listing available applications to debug. Select your application and press OK. Your breakpoints should now work.
If you need to debug something that happens on app startup, you can tell Android to wait for a debugger when launching certain applications with the following steps:
On the phone open the Android Settings
Open the Developer Options
Make sure Wait for debugger is checked
Press Select debug app and choose your application
Then when you start your application, it'll wait for you to attach a debugger via one of the two methods mentioned above.
Hope this helps!
In order to get the maven repository working with my Android Studio project (which I didn't know is what I was trying to do), I needed to add the following to build.gradle:
allprojects {
repositories {
mavenCentral()
}
}
Apparently, that allows the software to work out the compile commands.
I wanted to filter what is shown in the Android Studio Logcat to show what is relevant to my application only. I have chosen Show only selected applications from the drop down at the top of the logcat as shown in the following screenshot:
But in the drop down menu above it which is supposed to show running application(s) (and other options) from which we can choose our application to see Log messages related to it only, I see No debuggable Applications as the only option.
Why? What should I do to fix this?
Note: It does not happen every time I run the project. Sometimes it happens, sometimes it automatically selects my app (when I run it) from the drop down menu shown in the second screenshot, and filters the results properly.
Open Android Studio, Go to,
Tools-> Android -> Enable ADB Integration.
Open Android Monitor,
After enabling that, everything should work properly and you can see your package name of your application.
With v1.3.1 I disabled & enabled again "Enable ADB Integration" and it worked.
Go to Android Studio, Tools, Android, Disable ADB Integration and Enable it again. Make sure you clean your project before running !
Just click on 'debug icon'(BUG icon) next to 'run icon'(Arrow icon) then u can see app in logcat
This helped me:
1)Disconnect device
2)Kill adb from taskmanager
3)Clean project
4)Connect device
Make sure you have your DDMS window closed.
If it is open, your logs might be visible there but not in Android Studio.
In my case I used to use 2 Android Studio's (stable and canary) so the reason of the problem was this.
So, if you are running another IDE such as another Android Studio or Eclipse this could be the problem.
Solution: Close one of the IDE and if "Enable ADB Integration" is already enabled disabling and re-enabling solves it
For me it was a case of changing the build.gradle file to:
buildTypes {
release {
debuggable true
...
...
}
Project sync then the app should appear in the menu which previously only had No debuggable applications.
I had the same issue. As in this picture, instead of "app", it was class name. So click it and select "app" and the problem was solved.
Please make sure to have the android property debuggable = "true" in the application tag AndroidManifest.xml
**<application android:debuggable="true">
</application>**
Also, if you have multiple build variants (ex. debug, alpha, release) you may need to check which build you are attempting to debug and set the debuggable true attribute accordingly in the build.gradle
buildTypes {
debug {
...
debuggable true
...
}
alpha {
...
debuggable true
...
}
release {
...
debuggable false
...
}
}
I found that emulators worked fine with solutions listed above, but my real device never did. Eventually some log came up saying I needed to add the debug flag to my manifest. Since I am using project flavors, it was easy enough to add this to my debug build variant in my gradle file. However, you could also manually add the flag to the manifest as needed - just make sure to not have it there in a production app version.
you should make share your IDE(Intellij or AS) Build Variants settings
there is a simple
I am trying to start a project for google glass in android studio. I have all the SDK platforms required but still android studio keeps on giving me this error. Does anyone have any clue whats going on?
I just selected the update SDK option and then did rebuild. It said daemon started successfully
Sooooo...... remember to make changes in your build.gradle
change compileSdkVersion 15 to compileSdkVersion "Google Inc.:Glass Development Kit Sneak Peek:15"
I changed the compileSdkVersion to a lower one, synced, that failed, changed it back to the previous value, synced and it properly built. Very arbitrary, I know.
I had a similar problem. If you're on a mac than go into Android Studio/preferences/Appearance & Behavior/Android SDK and click on the SDK Tools tab. Update the Android SDK Platform Tools.
After you've updated this in the preference, go to Build/Clean Project. This takes a few seconds. When complete, go to Build/Rebuild Project.
The build should be successful this time.
If this doesn't work then go into file/ invalidate cashes restart
Hope this helps, Good luck.
Change targetSdkVersion and compileSdkVersion to the most current versions.