Skip to content

add changed needed to lower sdk to 21#120

Merged
mjtalbot merged 3 commits intomasterfrom
lowerVersionRequirementsTo21
Jun 8, 2021
Merged

add changed needed to lower sdk to 21#120
mjtalbot merged 3 commits intomasterfrom
lowerVersionRequirementsTo21

Conversation

@mjtalbot
Copy link
Copy Markdown
Contributor

@mjtalbot mjtalbot commented Jun 3, 2021

draft because it does not work (yet?)

(but this resolves other issues we would run into along the way to api v 21)

we run into this issue:

06-03 13:45:59.395 4378-4378/app.rive.runtime.example A/art: art/runtime/indirect_reference_table.cc:98] JNI ERROR (app bug): local reference table overflow (max=512)
06-03 13:45:59.395 4378-4378/app.rive.runtime.example A/art: art/runtime/indirect_reference_table.cc:98] local reference table dump:
06-03 13:45:59.395 4378-4378/app.rive.runtime.example A/art: art/runtime/indirect_reference_table.cc:98]   Last 10 entries (of 512):
06-03 13:45:59.395 4378-4378/app.rive.runtime.example A/art: art/runtime/indirect_reference_table.cc:98]       511: 0x71368f98 java.lang.Class<android.graphics.Paint$Style>
06-03 13:45:59.395 4378-4378/app.rive.runtime.example A/art: art/runtime/indirect_reference_table.cc:98]       510: 0x71368f98 java.lang.Class<android.graphics.Paint$Style>
06-03 13:45:59.395 4378-4378/app.rive.runtime.example A/art: art/runtime/indirect_reference_table.cc:98]       509: 0x7136bcf8 java.lang.Class<android.graphics.Paint>
06-03 13:45:59.395 4378-4378/app.rive.runtime.example A/art: art/runtime/indirect_reference_table.cc:98]       508: 0x7136bcf8 java.lang.Class<android.graphics.Paint>
06-03 13:45:59.395 4378-4378/app.rive.runtime.example A/art: art/runtime/indirect_reference_table.cc:98]       507: 0x12f1edd0 android.graphics.Paint
06-03 13:45:59.395 4378-4378/app.rive.runtime.example A/art: art/runtime/indirect_reference_table.cc:98]       506: 0x7136bcf8 java.lang.Class<android.graphics.Paint>
06-03 13:45:59.395 4378-4378/app.rive.runtime.example A/art: art/runtime/indirect_reference_table.cc:98]       505: 0x7136bcf8 java.lang.Class<android.graphics.Paint>
06-03 13:45:59.395 4378-4378/app.rive.runtime.example A/art: art/runtime/indirect_reference_table.cc:98]       504: 0x712da4a0 android.graphics.Paint$Style
06-03 13:45:59.395 4378-4378/app.rive.runtime.example A/art: art/runtime/indirect_reference_table.cc:98]       503: 0x71368f98 java.lang.Class<android.graphics.Paint$Style>
06-03 13:45:59.395 4378-4378/app.rive.runtime.example A/art: art/runtime/indirect_reference_table.cc:98]       502: 0x71368f98 java.lang.Class<android.graphics.Paint$Style>
06-03 13:45:59.410 4378-4378/app.rive.runtime.example A/art: art/runtime/indirect_reference_table.cc:98]   Summary:
06-03 13:45:59.410 4378-4378/app.rive.runtime.example A/art: art/runtime/indirect_reference_table.cc:98]        54 of android.graphics.Paint (54 unique instances)
06-03 13:45:59.410 4378-4378/app.rive.runtime.example A/art: art/runtime/indirect_reference_table.cc:98]         3 of java.lang.String (3 unique instances)
06-03 13:45:59.410 4378-4378/app.rive.runtime.example A/art: art/runtime/indirect_reference_table.cc:98]         3 of android.graphics.Paint$Cap (2 unique instances)
06-03 13:45:59.410 4378-4378/app.rive.runtime.example A/art: art/runtime/indirect_reference_table.cc:98]         2 of android.graphics.Path (2 unique instances)
06-03 13:45:59.410 4378-4378/app.rive.runtime.example A/art: art/runtime/indirect_reference_table.cc:98]         1 of app.rive.runtime.kotlin.RiveAnimationView
06-03 13:45:59.410 4378-4378/app.rive.runtime.example A/art: art/runtime/indirect_reference_table.cc:98]         1 of java.lang.String[] (3 elements)
06-03 13:45:59.410 4378-4378/app.rive.runtime.example A/art: art/runtime/indirect_reference_table.cc:98]         3 of android.graphics.Paint$Join (1 unique instances)
06-03 13:45:59.410 4378-4378/app.rive.runtime.example A/art: art/runtime/indirect_reference_table.cc:98]       392 of java.lang.Class (7 unique instances)
06-03 13:45:59.410 4378-4378/app.rive.runtime.example A/art: art/runtime/indirect_reference_table.cc:98]        53 of android.graphics.Paint$Style (2 unique instances)

@mjtalbot mjtalbot linked an issue Jun 3, 2021 that may be closed by this pull request
@mjtalbot
Copy link
Copy Markdown
Contributor Author

mjtalbot commented Jun 3, 2021

pretty sure this is related to us creating lots of objects (sure) but also how we refer to native classes from within the cpp bindings...

so we used to create these references once. and remember them. but they're not thread safe, so we now grab then on the fly. we do no cleanup here at the moment

e.g.

	jclass getClass(const char *name)
	{
		return static_cast<jclass>(getJNIEnv()->FindClass(name));
	}

https://stackoverflow.com/questions/20917777/jni-error-local-reference-table-overflow-512-entries

@mjtalbot mjtalbot force-pushed the lowerVersionRequirementsTo21 branch from 02f5022 to a5aabab Compare June 8, 2021 13:29
@mjtalbot mjtalbot marked this pull request as ready for review June 8, 2021 13:30
@mjtalbot
Copy link
Copy Markdown
Contributor Author

mjtalbot commented Jun 8, 2021

there are still some display issues, as not all blend modes are supported in < 29 & multiply seems to behave grossly different, but this enables compatibility!

@mjtalbot mjtalbot merged commit 34aa6d5 into master Jun 8, 2021
@mjtalbot mjtalbot deleted the lowerVersionRequirementsTo21 branch October 29, 2021 15:22
mjtalbot added a commit that referenced this pull request Jun 26, 2022
mjtalbot added a commit that referenced this pull request Jun 26, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

What is really the minimum SDK for the app?

1 participant