Android Studio 3.1 Run not compiling code
I have solution for your issue.
Also confirmed by Android Studio on Twitter : https://twitter.com/androidstudio/status/981914632892960768
- Edit your app configuration as below.
- Here you can see your app configuration as below.
- Here is missing Gradle-aware make attribute in before launch configuration. You can see here.
- Please add this Gradle-aware Make attribute through this way. Click on + icon and select Gradle-aware Make as seen in this screen.
- You can add this without writing any task just press OK button and task will be added and now it should look like this. Now apply changes and run your application.
It will solve this old apk installing issue on clean build in new Android Studio 3.1 issue.
Note : This issue is resolved in new Android Studio 3.1.1 Stable release.
Android studio 3.1 run command does not rebuild the APK
Go to Run -> Edit configurations
. And then make sure you have Gradle-aware Make
option like below screenshot.
If not then click +
and select from the
More update in twitter regarding this:https://twitter.com/androidstudio/status/981914632892960768
Android Studio 4.1.1 “Run” not compiling code
You need to Enable instant app support for that.
In the toolbar menu of Android studio, go to Refactor -> Select Enable Instant Apps Support option -> select the desired module and click OK.
This will add the below line in Manifest file:
<dist:module dist:instant="true" />
Once done, edit Run configurations and there you will find checkbox of Deploy as Instant app in Installation options section, enable it, and then run the app on the device, you will find the Instant app running on your device.
Note: Please uninstall the previous version of app if any.
For step by step guide, follow below reference before following above steps, there is also dependency that needs to be added.
Reference:
Google Instant App Guide
Android studio update (3.1.1) and now app won't run
The task that is failing is::app:transformDexWithInstantRunDependenciesApkForDebug
Try turning off Instant Run:
- Open the
Settings
orPreferences
dialog: OnWindows
orLinux
,
select File > Settings from the menu bar. On Mac OSX, select Android
Studio > Preferences from the menu bar. - Navigate to
Build, Execution, Deployment > Instant Run
. - Uncheck the box next to Restart activity on code changes.
- Re-build.
This is Google issue 72811718 a bug in AS 3.1+
Android Studio 3.1 not showing build error details
There is a toggle button just below the build button that will show the verbose build logs. Tap that and you should be able to see errors like before AS 3.1.
Error building project with Android Studio 3.1 and build:gradle 3.1.0
I found the solution finally.
I used findViewbByiId
for each view defined in the layout file to get reference from the XML.
But in Android Studio 3.1 no need use this anymore.
I simply remove all findViewbByiId
code where i place to get reference from XML widgets, now error has gone.!
Related Topics
Android Onclick in Xml VS. Onclicklistener
How to Make a Phone Call Programmatically
How to Lock Orientation During Runtime
How to Make a View with Rounded Corners
Pick Any Kind of File via an Intent in Android
Simulate Low Network Connectivity for Android
Ripple Effect on Android Lollipop Cardview
Send Data Back to the Script Which Started the Activity via Adb Shell Am Start
Realmchangelistener Does Not Get Called When Realm Gets Updated in Notificationlistenerservice
Activity Declaration in Androidmanifest.Xml
First Launch Take Long Time (Classloader Referenced Unknown Path)
How to Set Custom Font for a Whole Application in Android
Cursor Adapter and SQLite Example
Custom Row in a Listpreference
How to Always Run a Service in the Background