android-studio

Build failed with an exception error in Kotlin

本秂侑毒 提交于 2021-01-29 08:16:35
问题 Got this error after updating my Kotlin plugin on android studio. package com.example.test fun main(args: Array<String>) { println("Hello world") } This is the error I receive: * Where: Initialization script '/private/var/folders/bn/st769wd16nv1d5_wccw8_tm00000gn/T/Test_main__2.gradle' line: 27 * What went wrong: A problem occurred configuring project ': app'. > Could not create task ':app:Test.main()'. > SourceSet with name 'main' not found. When I run a stack trace, this is the response I

Android Studio: While Loop Freezing Application

只谈情不闲聊 提交于 2021-01-29 08:13:47
问题 My code on an app in Android Studio, consisting of a start/stop button for recording audio using AudioRecord and then outputting that audio data to a text view, works great when done once. If I repeatedly click the button, it works too. However, if I put it in a while loop, the app freezes (only the app freezes; same result on an emulator and a real smartphone). I believe I've found that it doesn't have anything to do with AudioRecord, or putting the loop in the button listener or putting it

Clarification: How can I show the BottomNavigationView tab is highlighted if the navigation is done via Menu Item or any other option in android

☆樱花仙子☆ 提交于 2021-01-29 08:11:42
问题 I have a large number of fragments. Here the BottomNavigationView has only four icons for tabs. But each tabs has multiple fragments. For Example: I am in home feed screen defaulty. I have a menu item. Clicks on profile label and moved to profile section. Here it needs to highlight the profile icon. How it can be done without click on the BottomNavigationBar in android. 来源: https://stackoverflow.com/questions/64986344/clarification-how-can-i-show-the-bottomnavigationview-tab-is-highlighted-if

How to retrieve a single media file from external storage using Mediastore?

巧了我就是萌 提交于 2021-01-29 08:10:14
问题 Before API 29, we could have easily retrieved a media file from external storage using these lines of code. val dirName = Environment.getExternalStorageDirectory().absolutePath + "/$appName/" val fileName = "$appName_$timeStamp.$extension" val dir = File(dirName) val file = File(dir, fileName) But I was unable to find a code snippet which can achieve the same thing using Mediastore API. Since getExternalStorageDirectory is deprecated in API 29, I don't know how to do. I have searched about

Android studio new project buttons are off and disabled

戏子无情 提交于 2021-01-29 07:42:51
问题 I am very new to android development, and i have a very simple question about andriod studio program. I have installed every thing that is needed to open it, But now , when i want to create a new project i can't continue , check this shot screen : http://i.stack.imgur.com/yFUi3.png The next button is disabled ! What should i do to do next ? 回答1: Most likely this is because you don't have any SDK's installed. In Android Studio, go to tools -> Android -> SDK manager and download the API's you

Failed to install HAXM for Android Studio (AMD)

旧时模样 提交于 2021-01-29 07:34:15
问题 I tried many things (disable hyper-v etc.). How can I install haxm in AMD ? 回答1: Haxm does not support AMD, only Intel. To run android studio on AMD with hardware acceleration you can use AMD Hypervisor - https://androidstudio.googleblog.com/2019/12/emulator-29211-and-amd-hypervisor-12-to.html. 来源: https://stackoverflow.com/questions/64825504/failed-to-install-haxm-for-android-studio-amd

How to serialize and deserialize in android?

烈酒焚心 提交于 2021-01-29 07:30:58
问题 my mainActivity has a ListView which should display my CustomList: import java.io.File; import java.io.FileInputStream; import java.io.FileOutputStream; import java.io.ObjectInputStream; import java.io.ObjectOutputStream; import java.io.Serializable; import java.util.ArrayList; public class CustomList implements Serializable { private static final long serialVersionUID = 1L; private ArrayList<Game> list = new ArrayList<Game>(); public void add(Game toAdd){ list.add(toAdd); } public Game get

Is it possible to test android app on Android VM under Virtual Box from Android studio running on host

大城市里の小女人 提交于 2021-01-29 06:50:48
问题 Did anybody try to test android apps on an Android VM I've installed Android VM (9) under VirtualBox (5.2) and Android Studio (4.1) on a Host machine (Windows 10). Followed the network setup steps described at Test android app on Virtual Box from Android studio 5 years ago, and can even connect to the VM from adb (running on the host) in command line, but the studio still cannot see the device. 回答1: Resolved it It turned out there was a file named .android in the Windows user home folder.

Application terminates unexpectedly [duplicate]

左心房为你撑大大i 提交于 2021-01-29 06:19:42
问题 This question already has answers here : What is a NullPointerException, and how do I fix it? (12 answers) Android “Only the original thread that created a view hierarchy can touch its views.” (30 answers) Closed 6 months ago . public class MainActivity extends AppCompatActivity { public String[] epc; public int i = 0; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); Toolbar toolbar = (Toolbar)

Android studio - flutter: No Connected Devices

痴心易碎 提交于 2021-01-29 05:28:41
问题 I have just started with mobile development using flutter, and there is this error when trying to run the default flutter program. No connected devices found; please connect a device, or see flutter.dev/setup for getting started instructions. This is a Windows 10 x64 machine. Installed Android Studio in - D:\Program Files\Android\Android Studio1 Installed Android SDK from Android Studio in - D:\Android\android-sdk Set these system environment variables ANDROID_HOME - D:\Android\android-sdk;D: