Android Room – simple select query – Cannot access database on the main thread

I am trying a sample with Room Persistence Library. I created an Entity: @Entity public class Agent { @PrimaryKey public String guid; public String name; public String email; public String password; public String phone; public String licence; } Created a DAO class: @Dao public interface AgentDao { @Query(“SELECT COUNT(*) FROM Agent where email = :email … Read more

How to fix ‘Unable to determine application id: com.android.tools.idea.run.ApkProvisionException: No outputs for the main artifact of variant:’

I am trying to run a selected build variant but giving me following error in Run tab, Unable to determine application id: com.android.tools.idea.run.ApkProvisionException: No outputs for the main artifact of variant: madhyapradesh-debug So kindly suggest the solution to it. 23 Answers 23

Unsupported method: BaseConfig.getApplicationIdSuffix()

So I’m reading Android 6 for Programmers: An App-Driven Approach and the first two app examples I had no issues with the examples, this time the FlagQuiz example when loaded in Android Studio 3.0 Canary-3 I’m getting this error which isn’t letting me build the project: Error:Unsupported method: BaseConfig.getApplicationIdSuffix(). The version of Gradle you connect … Read more

Unable to merge dex

I have Android Studio Beta. I created a new project with compile my old modules but when I tried launching the app it did not launch with the message: Error:Execution failed for task ‘:app:transformDexArchiveWithExternalLibsDexMergerForDebug’. com.android.builder.dexing.DexArchiveMergerException: Unable to merge dex But I don’t know how to solve this error. I googled this for hours but with … Read more

Android emulator not able to access the internet

I know that similar questions have been asked before, but my problem is new only after installing Android Studio 2.3, the latest version in March 2017. I have several years experience developing Android applications, and I have never encountered this problem before. After upgrading to version 2.3 of Android Studio, my emulator is no longer … Read more