mikepenz/AboutLibraries

Black activity and show only app bar

maxrave-dev opened this issue · 4 comments

About this issue

  • Black activity and show only app bar

  • This code I use to open activity
binding.bt3rdPartyLibraries.setOnClickListener {
    getJsonDataFromAsset(requireContext())?.let {
        LibsBuilder()
            .withLicenseShown(true)
            .withVersionShown(true)
            .withActivityTitle(getString(R.string.third_party_libraries))
            .withSearchEnabled(true)
            .withEdgeToEdge(true)
            .withLibs(
                Libs.Builder()
                    .withJson(it) // provide the metaData (alternative APIs available)
                    .build()
            )
            .start(requireContext())
    }
}
  • Log cat show this logs:
android.view.WindowLeaked: Activity com.mikepenz.aboutlibraries.ui.LibsActivity has leaked window android.widget.LinearLayout{8fc9bfb V.E...... .......D 0,0-143,55} that was originally added here
                                                                	at android.view.ViewRootImpl.<init>(ViewRootImpl.java:943)
                                                                	at android.view.ViewRootImpl.<init>(ViewRootImpl.java:931)
                                                                	at android.view.WindowManagerGlobal.addView(WindowManagerGlobal.java:391)
                                                                	at android.view.WindowManagerImpl.addView(WindowManagerImpl.java:148)
                                                                	at com.android.internal.view.TooltipPopup.show(TooltipPopup.java:74)
                                                                	at android.view.View.showTooltip(View.java:31396)
                                                                	at android.view.View.showHoverTooltip(View.java:31430)
                                                                	at android.view.View.$r8$lambda$27VXCdyLVNkujfByQKuywAc_nkI(Unknown Source:0)
                                                                	at android.view.View$$ExternalSyntheticLambda2.run(Unknown Source:2)
                                                                	at android.os.Handler.handleCallback(Handler.java:942)
                                                                	at android.os.Handler.dispatchMessage(Handler.java:99)
                                                                	at android.os.Looper.loopOnce(Looper.java:201)
                                                                	at android.os.Looper.loop(Looper.java:288)
                                                                	at android.app.ActivityThread.main(ActivityThread.java:7918)
                                                                	at java.lang.reflect.Method.invoke(Native Method)
                                                                	at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:548)
                                                                	at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:936)

Details

  •  Used library version
  •  Used support library version
  •  Used gradle build tools version
  •  Used tooling / Android Studio version
  •  Other used libraries, potential conflicting libraries

Checklist

When you open the activity, can you verify the libs you load contain information?

image
This is aboutliraries.json but when load is only {"metadata":{"generated":"2023-11-05T15:48:30.735Z"},"libraries":[] }

So it seems something is wrong with the loading logic maybe? (either wrong file loaded or so 🤔 )

The json string you get? is it the one you attached above?

I fixed by using this code

val inputStream = requireContext().resources.openRawResource(R.raw.aboutlibraries)
            val scanner = Scanner(inputStream).useDelimiter("\\A")
            val stringBuilder = StringBuilder()
            while (scanner.hasNextLine()) {
                stringBuilder.append(scanner.nextLine())
            }
            Log.w("AboutLibraries", stringBuilder.toString())
            val localLib = Libs.Builder().withJson(stringBuilder.toString()).build()
                val intent = LibsBuilder()
                    .withLicenseShown(true)
                    .withVersionShown(true)
                    .withActivityTitle(getString(R.string.third_party_libraries))
                    .withSearchEnabled(true)
                    .withEdgeToEdge(true)
                    .withLibs(
                        localLib
                    )
                    .intent(requireContext())
                startActivity(intent)
        }