koin default implementation without name reference

I have 2 Retrofit Clients one of them default and second one has different implementation like (base URL, interceptors etc… )

i need to inject default client without using name reference

first client :-

single<Retrofit> {

Second Client:-

single<Retrofit>("retrofit_second") {
                .baseUrl("diffrent url")

My way to inject

val myModule = module {
    factory { get<Retrofit>().create( } // Why Koin did not figure it without providing its default name !?
    factory { get<Retrofit>("retrofit_second").create( }
    factory<IMyRemoteDataSource> { MyRemoteDataSource(get(), get()) }
    factory<IMyRepository> { MyRepository(get()) }
    factory { MyUseCase(get()) }

the result is :

        Multiple definitions found for type 'class retrofit2.Retrofit' - Koin can't choose between :
    Single [name='retrofit_second',class='retrofit2.Retrofit']
    Single [name='Retrofit',class='retrofit2.Retrofit']

Why Koin did not get the default Retrofit instance without providing its default name (Retrofit ) !?

factory { get<Retrofit>().create( }


You are right @Eslam. Current behavior (as of koin:1.0.2) is when you don’t specify the dependency name, it is treated as an empty string. And then the definitions get filtered by class name:

fun searchByClass(clazz: KClass<*>): List<BeanDefinition<*>> {
    return definitions.filter { clazz in it.classes }

As a result you get both of your definitions, which results in the above mentioned error: Multiple definitions for class ....


ViewBinding manipulate view after inflating

I have an instance where I used to pass my View onto a new method to manipulate a couple of things. here I will provide an example. So Basically I am using a RecyclerView and I am inflating the view when the recylerview creates the view

So now I have the inflated View object now I just pass it to my method to manipulate it.

manipulateView(view) manipulateView sets up the color and attributes for the view children

and that used to work and everything. but now I am moving onto ViewBinding

now I have a ViewStub for where I need to inflate my customView

as follows here is the code

ViewDataBinding viewDataBinding = DataBindingUtil.inflate(layoutInflater, getLayoutResource(), viewGroup, false);
ViewStub viewStub = (ViewStub) viewDataBinding.getRoot().findViewById(;

and then I set the layout for the viewStub here


now setLayoutResource expects an int value with the id of the layout now my question is how can I call manipulateView on getLayoutResource() should I just pass the viewStub and then call viewStub.getRootView() and Manipulate that view?

It would be the best if I was able to manipulate the ViewDataBinding object it self, Should I just manipulate ViewDataBinding::getRoot?


The view that gets inflated by calling layoutInflater.inflate(...) is the same view you would get from viewDataBinding.getRoot(). From the docs, root “returns the outermost view”.

So, if that’s what you want to manipulate, I would just call manipulateView(viewDataBinding.root).


Get HTML and CSS from grapes.js newsletter editor in Javascript

How to get output HTML and CSS of grapes.js in Javascript ?

I am writing a Django app for newsletter, in which I need a newsletter editor for which I used “grapes.js” newsletter. Everything is fine but I am stuck in part where I need to get the HTML and CSS of the template created with it.
I have:

<script type="text/javascript">
  var editor = grapesjs.init({
  container : '#gjs',
  plugins: ['gjs-preset-newsletter'],
  pluginsOpts: {
    'gjs-preset-newsletter': {
      modalTitleImport: 'Import template',
    'grapesjs-plugin-export': { /* options */ }
      // ... other options
function returnHtml(){ 
    const mjml = editor.getHtml;
    preview = editor.getHtml

This code gives me the html of the template but without the css !

I have tried Can someone please suggest me what i am missing ? Thanks.

EDIT: I have an answer below but what i need is like this with html and css together like in export HTML.Thanks again.


Getting only HTML:

var html = editor.getHtml();

Getting only CSS:

var css = editor.getCss();

Getting HTML with CSS inline:

var htmlWithCss = editor.runCommand('gjs-get-inlined-html');

NetworkSecurityConfig: No Network Security Config specified, using platform default Error response code: 400

I’m trying to connect to either of these places and get the JSON data:-

All three I can get to via the browser, but when I try to access them via an android app I get the following errors:-

NetworkSecurityConfig: No Network Security Config specified, using platform default
Error response code: 400

I’ve added this to manifest.xml:-

<uses-permission android:name="android.permission.INTERNET"/>

I also added this to the manifest.xml:-


And created res/xml/network_security_config.xml, which contains:-

<?xml version="1.0" encoding="utf-8"?>
        <domain includeSubdomains="true"></domain>>

Which changes the error to:-

D/NetworkSecurityConfig: Using Network Security Config from resource network_security_config debugBuild: true
Error response code: 400

I know it’s missing:-

    <certificates src="@raw/my_ca"/>

but I have no idea where or what the certificate would be or if it’s needed.

Not really sure what is going on, any help would be appreciated.

IN ADDITION:- I am able to connect fine and get the JSON from this URL:-

All I get is this:-

No Network Security Config specified, using platform default

Buy not error 400 and gets through with a 200 instead. So it makes me think there is something weird going on, but not sure where.


Try these solutions

Solution 1)

Add the following attribute to the <application tag in AndroidManifest.xml:


Solution 2)

Add android:networkSecurityConfig="@xml/network_security_config" to the <application tag in app/src/main/AndroidManifest.xml:


With a corresponding network_security_config.xml in app/src/main/res/xml/:

<?xml version="1.0" encoding="utf-8"?>
    <base-config cleartextTrafficPermitted="true" />

enter image description here

Refer this answer for more info: Download Manger not working in Android Pie 9.0 (Xiaomi mi A2)


Blue flash light (Arc) on Google Maps

Is there any way to have access to the blue flash light appears on google map? I have read in different forums that this blue arc is representative of the reliability of the magnet sensor, is there any way to have access to it in android?


I went through Android SDK for magnet outputs. I have found one method that measure the accuracy of magnet based direction of movement. Have you seen following method?

public void onAccuracyChanged(Sensor sensor, int i) {
    if(sensor.getType() == Sensor.TYPE_MAGNETIC_FIELD){


This outputs the accuracy in 4 levels for magnet based heading estimation.

Source: stackoverflow
Text is available under the Creative Commons Attribution-ShareAlike License; additional terms may apply. By using this site, you agree to the Privacy Policy, and Copyright Policy. Content is available under CC BY-SA 3.0 unless otherwise noted. The answers/resolutions are collected from stackoverflow, are licensed under cc by-sa 2.5 , cc by-sa 3.0 and cc by-sa 4.0 © No Copyrights, All Questions are retrived from public domain..