How to embed android emulator inside Android Studio? - android-studio

I know that an embedded emulator has been introduced in Android Studio 4.1+. I am not able to see options to enable it.

The changelog says that you need to enable it manually. Follow these steps:
Steps
Open Android Studio and goto Preference / Settings
Expand the Tools tab and goto emulator
Check 'Launch in a tool window'

Apart from the previous, if you dont't see the emulator tab in IDE:
I found that adding a "<module fileurl="file://$PROJECT_DIR$/android/..." line in Project directory, file .idea/modules.xml the tab appears:
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="ProjectModuleManager">
<modules>
<module fileurl="file://$PROJECT_DIR$/renal_calc_flutter.iml" filepath="$PROJECT_DIR$/renal_calc_flutter.iml" />
<module fileurl="file://$PROJECT_DIR$/android/renal_calc_flutter_android.iml" filepath="$PROJECT_DIR$/android/renal_calc_flutter_android.iml" />
</modules>
</component>
</project>

Related

Gradle unable to rebuild in android studio

So i am still new to android studio and after finishing a test project,i kept getting errors about the gradle build and i dont understand what to do
startup failed:
build file 'C:\Users\*******\AndroidStudioProjects\Provac\build.gradle': 1: unexpected token: < # line 1, column 1.
<?xml version="1.0" encoding="utf-8"?>
^
1 error
The actual build.gradle file:
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="rectangle"/>
The problem is that your build.gradle file has been overwritten by an unrelated XML file, either due to human error or a bug in some piece of software.
If you have a backup or an earlier version of your code from version control, you should restore from it. Otherwise, you'll need to recreate your build.gradle file manually. The build.gradle file created by the Android Studio new project wizard is probably a good start, if you have to do that.

Error initializing ADB: Debug Bridge not found

I want to work with some files in flutter and so I wanted to use the Android Studio Device File Explorer to check if everything works correctly.
But the Device File Explorer shows a red warning "Error initializing ADB: Android Debug Bridge not found"
On a "normal" Android Project with Java there is no Problem and everything is displayed correctly.
I reinstalled Android Studio, changed the AVD but nothing changed.
Is this a bug in Flutter or Android Studio?
Thanks for helping.
Ok, I solved the problem. You must go to your Project Structure, add a Project SDK to your project and reopen Android Studio. Then the Problem should be solved.
The error might occur when you create a Flutter app in VS Code instead of Android Studio. To fix it, simply add a misc.xml file in your .idea folder, with the following contents or similar:
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="ProjectRootManager" version="2" languageLevel="JDK_12" default="false" project-jdk-name="Android API 29 Platform" project-jdk-type="Android SDK" />
<component name="ProjectType">
<option name="id" value="io.flutter" />
</component>
</project>
You could also create a new Flutter project in Android Studio to view the contents of misc.xml as it might differ slightly.

How to turn off notification in Android Studio to set proxy configuration in the project's gradle.properties file?

I'm switching our project from Eclipse to Android Studio. I had the proxy settings in our project's gradle.properties file, but then I realized that I have to check this file into version control and it would expose my passwords.
I moved these settings to [USER_HOME]/.gradle/gradle.properties and it works fine, except for Android Studio asks at every gradle sync if I want to copy the configuration back to the project folder.
How do I turn this notification off?
In ${idea.config.path}/options/options.xml file, there is a /application/component[#name='PropertiesComponent']/property[#name='show.do.not.copy.http.proxy.settings.to.gradle'] element node.
If its value is true(default value), "Proxy Settings" dialog will be shown normally;
<property name="show.do.not.copy.http.proxy.settings.to.gradle" value="true" />
if its value is false, Android Studio will "do not ask again".
<property name="show.do.not.copy.http.proxy.settings.to.gradle" value="false" />
Tips:
Don't forget to click Synchronize(Ctrl+Alt+Y) button or File->Synchronize, after change this file.
idea.config.path is set in android-studio\bin\idea.properties, whose default value is ${user.home}/.AndroidStudio${version}/config
Tested with Android Studio 1.4 Preview 2 # Win8.1 X64
In 1.3 version of Android studio there is a checkbox "do not ask again". And that exactly is the problem I'm having. I've checked it because everything was functioning OK without it but now I'd like to bring that dialog back as for the past couple of days the projects don't compile because gradle can not resolve new dependencies.
This setting <property name="show.do.not.copy.http.proxy.settings.to.gradle" value="true" /> could also be located in your project's folder in the file .idea\workspace.xml.

SGEN : error : Mixed mode assembly

Can anyone help me im getting this error when im publishing my project on release mode
SGEN : error : Mixed mode assembly is built against version 'v2.0.50727' of the runtime and cannot be loaded in the 4.0 runtime without additional configuration information.
Please help me im stuck on this issue.
There is an answer in Microsoft Support (https://support.microsoft.com/en-za/help/2572158/sgen-mixed-mode-assembly-is-built-against-version-v2-0-50727-of-the-ru) which says:
In order to use mixed mode assemblies in 4.0, it must be configured in the configuration file for Sgen
Resolution
Add the information below to the sgen.exe.config file located at the following location: ..\Program Files\Microsoft SDKs\Windows\v7.0A\bin\NETFX 4.0 Tools\
<?xml version ="1.0"?>
<configuration>
<startup useLegacyV2RuntimeActivationPolicy="true">
<supportedRuntime version="v4.0" />
</startup>
</configuration>
For Visual Studio 2017 the path is different and can be like: c:\Program Files (x86)\Microsoft SDKs\Windows\v10.0A\bin\NETFX 4.6.1 Tools\
For Build/Publish in Release Mode please follow below step
create a new file as sgen.exe.config
keep below code in that file
<?xml version ="1.0"?>
<configuration>
<runtime>
<generatePublisherEvidence enabled="false"/>
</runtime>
<startup useLegacyV2RuntimeActivationPolicy="true">
<supportedRuntime version="v4.0"/>
</startup>
</configuration>
Please keep this file in below path
C:\Program Files (x86)\Microsoft SDKs\Windows\v8.1A\bin\NETFX 4.5.1 Tools Folder
And for x64
C:\Program Files (x86)\Microsoft SDKs\Windows\v8.1A\bin\NETFX 4.5.1 Tools\x64 Folder
Now restart Visual Studio
Open Project in Administrator mode and Build/Publish in Release Mode.

Custom NuGet Package not installed in Visual Studio

I've created two NuGet package files
Foo.1.0.0.nupkg
Foo.1.0.1.nupkg
Both files are located in a folder on my PC, which I've configured as a package source in Visual Studio. I created a console app project which contains a NuGet.config file:
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<config>
<!--
Used to specify the default location to expand packages.
See: NuGet.exe help install
See: NuGet.exe help update
-->
<add key="repositorypath" value="Packages" />
</config>
<packageRestore>
<!-- Allow NuGet to download missing packages -->
<add key="enabled" value="True" />
<!-- Automatically check for missing packages during build in Visual Studio -->
<add key="automatic" value="True" />
</packageRestore>
<packageSources>
<add key="Confused NuGet Packages" value="D:\NuGet Packages" />
</packageSources>
</configuration>
There is also a packages.config file associated with the solution, but there are no packages listed in that file, it's a blank canvas, which is fine.
When I look in the "Online" section in NuGet Package Manager, I can see both my custom packages, but regardless of which one I choose, when I click "Install" nothing happens. The package I choose is not installed.
Why is this?
Also, when I want to update a NuGet package, how can I do this and get the new package to appear in the "Updates" section of NuGet Package Manager? How can this be done?
I'm not 100% sure if this is the answer, but I did the following and the result is that my NuGet packages now appear in the "Installed" section, as well as the "Update" section after I create a new package.
First, for the class library DLL file I was using in the package, I added it to the "lib" special folder in NuGet Package Manager.
Also I made sure that the AssemblyVersion and AssemblyFileVersion details in AssemblyInfo.cs were correct for each version of the class library. After doing these two steps, everything clicked into place.

Resources