Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixed crash 'java.lang.IllegalArgumentException: Parameter specified …' #63

Merged
merged 9 commits into from
Oct 17, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
119 changes: 118 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,121 @@ build/

*.sfb

pubspec.lock
# Miscellaneous
*.class
*.lock
*.log
*.pyc
*.swp
.DS_Store
.atom/
.buildlog/
.history
.svn/

# IntelliJ related
*.iml
*.ipr
*.iws
.idea/

# Visual Studio Code related
.classpath
.project
.settings/
.vscode/

# Flutter repo-specific
/bin/cache/
/bin/mingit/
/dev/benchmarks/mega_gallery/
/dev/bots/.recipe_deps
/dev/bots/android_tools/
/dev/devicelab/ABresults*.json
/dev/docs/doc/
/dev/docs/flutter.docs.zip
/dev/docs/lib/
/dev/docs/pubspec.yaml
/dev/integration_tests/**/xcuserdata
/dev/integration_tests/**/Pods
/packages/flutter/coverage/
version
analysis_benchmark.json

# packages file containing multi-root paths
.packages.generated

# Flutter/Dart/Pub related
**/doc/api/
.dart_tool/
.flutter-plugins
.flutter-plugins-dependencies
**/generated_plugin_registrant.dart
.packages
.pub-cache/
.pub/
build/
flutter_*.png
linked_*.ds
unlinked.ds
unlinked_spec.ds

# Android related
**/android/**/gradle-wrapper.jar
**/android/.gradle
**/android/captures/
**/android/gradlew
**/android/gradlew.bat
**/android/local.properties
**/android/**/GeneratedPluginRegistrant.java
**/android/key.properties
*.jks

# iOS/XCode related
**/ios/**/*.mode1v3
**/ios/**/*.mode2v3
**/ios/**/*.moved-aside
**/ios/**/*.pbxuser
**/ios/**/*.perspectivev3
**/ios/**/*sync/
**/ios/**/.sconsign.dblite
**/ios/**/.tags*
**/ios/**/.vagrant/
**/ios/**/DerivedData/
**/ios/**/Icon?
**/ios/**/Pods/
**/ios/**/.symlinks/
**/ios/**/profile
**/ios/**/xcuserdata
**/ios/.generated/
**/ios/Flutter/.last_build_id
**/ios/Flutter/App.framework
**/ios/Flutter/Flutter.framework
**/ios/Flutter/Flutter.podspec
**/ios/Flutter/Generated.xcconfig
**/ios/Flutter/app.flx
**/ios/Flutter/app.zip
**/ios/Flutter/flutter_assets/
**/ios/Flutter/flutter_export_environment.sh
**/ios/ServiceDefinitions.json
**/ios/Runner/GeneratedPluginRegistrant.*

# macOS
**/macos/Flutter/GeneratedPluginRegistrant.swift
**/macos/Flutter/Flutter-Debug.xcconfig
**/macos/Flutter/Flutter-Release.xcconfig
**/macos/Flutter/Flutter-Profile.xcconfig

# Coverage
coverage/

# Symbols
app.*.symbols

# Exceptions to above rules.
!**/ios/**/default.mode1v3
!**/ios/**/default.mode2v3
!**/ios/**/default.pbxuser
!**/ios/**/default.perspectivev3
!/packages/flutter_tools/test/data/dart_dependencies_test/**/.packages
!/dev/ci/**/Gemfile.lock
134 changes: 134 additions & 0 deletions .idea/codeStyles/Project.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 6 additions & 0 deletions android/gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
#Tue Sep 15 12:06:53 AWST 2020
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-6.1.1-all.zip
Original file line number Diff line number Diff line change
Expand Up @@ -191,9 +191,20 @@ class ArCoreView(val activity: Activity, context: Context, messenger: BinaryMess
loadMesh(textureBytes)
}
"dispose" -> {
Log.i(TAG, " updateMaterials")
Log.i(TAG, "Disposing ARCore now")
dispose()
}
"resume" -> {
Log.i(TAG, "Resuming ARCore now")
onResume()
}
"getTrackingState" -> {
Log.i(TAG, "1/3: Requested tracking state, returning that back to Flutter now")

val trState = arSceneView?.arFrame?.camera?.trackingState
Log.i(TAG, "2/3: Tracking state is " + trState.toString())
methodChannel.invokeMethod("getTrackingState", trState.toString())
}
else -> {
}
}
Expand All @@ -220,7 +231,7 @@ class ArCoreView(val activity: Activity, context: Context, messenger: BinaryMess

private fun setupLifeCycle(context: Context) {
activityLifecycleCallbacks = object : Application.ActivityLifecycleCallbacks {
override fun onActivityCreated(activity: Activity, savedInstanceState: Bundle) {
override fun onActivityCreated(activity: Activity?, savedInstanceState: Bundle?) {
Log.i(TAG, "onActivityCreated")
// maybeEnableArButton()
}
Expand All @@ -240,15 +251,16 @@ class ArCoreView(val activity: Activity, context: Context, messenger: BinaryMess
}

override fun onActivityStopped(activity: Activity) {
Log.i(TAG, "onActivityStopped")
onPause()
Log.i(TAG, "onActivityStopped (Just so you know)")
// onPause()
}

override fun onActivitySaveInstanceState(activity: Activity, outState: Bundle) {}

override fun onActivityDestroyed(activity: Activity) {
Log.i(TAG, "onActivityDestroyed")
onDestroy()
Log.i(TAG, "onActivityDestroyed (Just so you know)")
// onDestroy()
// dispose()
}
}

Expand Down Expand Up @@ -470,6 +482,7 @@ class ArCoreView(val activity: Activity, context: Context, messenger: BinaryMess
}

if (arSceneView?.session != null) {
arSceneView!!.getPlaneRenderer().setVisible(false)
Log.i(TAG, "Searching for surfaces")
}
}
Expand All @@ -481,11 +494,20 @@ class ArCoreView(val activity: Activity, context: Context, messenger: BinaryMess
}

fun onDestroy() {
if (arSceneView != null) {
arSceneView?.scene?.removeOnUpdateListener(sceneUpdateListener)
arSceneView?.scene?.removeOnUpdateListener(faceSceneUpdateListener)
arSceneView?.destroy()
arSceneView = null
if (arSceneView != null) {
Log.i(TAG, "Goodbye ARCore! Destroying the Activity now 7.")

try {
arSceneView?.scene?.removeOnUpdateListener(sceneUpdateListener)
arSceneView?.scene?.removeOnUpdateListener(faceSceneUpdateListener)
Log.i(TAG, "Goodbye arSceneView.")

arSceneView?.destroy()
arSceneView = null

}catch (e : Exception){
e.printStackTrace();
}
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ open class BaseArCoreView(val activity: Activity, context: Context, messenger: B

private fun setupLifeCycle(context: Context) {
activityLifecycleCallbacks = object : Application.ActivityLifecycleCallbacks {
override fun onActivityCreated(activity: Activity, savedInstanceState: Bundle) {
override fun onActivityCreated(activity: Activity, savedInstanceState: Bundle?) {
Log.i(TAG, "onActivityCreated")
}

Expand All @@ -70,7 +70,7 @@ open class BaseArCoreView(val activity: Activity, context: Context, messenger: B

override fun onActivityDestroyed(activity: Activity) {
Log.i(TAG, "onActivityDestroyed")
onDestroy()
// onDestroy()
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,8 @@ class RenderableCustomFactory {
val url = flutterArCoreNode.objectUrl

val localObject = flutterArCoreNode.object3DFileName

if (localObject != null) {
Log.e(TAG, "Modified by BrutalCoding - 1");
if (false) {
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is it a mistake?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi,

The LOG should definitly be removed and the false statement was there on purpose I believe, because localObject (fbx, GLTF, obj) were not working for me. In my personal use case, in order to use local objects, I pass an "file://path/to/something.glb" url which works. The example app you've provided with local objects also don't seem to work hence why I've set false in that condition.

Correct me if I'm wrong.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In case you do want to merge this PR, I would actually remove localObject from Flutter's side too so people can't try it out and see nothing happening.

If localObject does work, I would be curious how. I've used Android Studio and SceneForm plugin to convert my .gltf to .sfa/.sfb but that plugin is completely broken starting from Android Studio 3.6+. I believe that plugin works with 3.5.x but never got the local object working.

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The LOG should definitly be removed and the false statement was there on purpose I believe, because localObject (fbx, GLTF, obj) were not working for me. In my personal use case, in order to use local objects, I pass an "file://path/to/something.glb" url which works. The example app you've provided with local objects also don't seem to work hence why I've set false in that condition.

Correct me if I'm wrong

I use sfb file in my example, The sfb files are generated from build.gradle

If localObject does work, I would be curious how. I've used Android Studio and SceneForm plugin to convert my .gltf to .sfa/.sfb but that plugin is completely broken starting from Android Studio 3.6+. I believe that plugin works with 3.5.x but never got the local object working.

Yes, the sceneform plugin doesn't work good. I'm using 1.15.0 with Android Studio 4.0.1 while Android side i'm using 1.13.0 how you can see here.

I will try different local object format inserted inside src/main/assets directly.

Thanks

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could you remove this change and resolve conflicts? So I will accept this PR.
We can discuss about local and asset object in another PR. I would like to edit the properties to use sfb file from assets and local object (GLTF) from path like yo do ("file://path/to/something.glb")

val builder = ModelRenderable.builder()
builder.setSource(context, Uri.parse(localObject))
builder.build().thenAccept { renderable ->
Expand All @@ -42,7 +42,7 @@ class RenderableCustomFactory {
val renderableSourceBuilder = RenderableSource.builder()

renderableSourceBuilder
.setSource(context, Uri.parse(url), RenderableSource.SourceType.GLTF2)
.setSource(context, Uri.parse(url), RenderableSource.SourceType.GLB)
.setScale(0.5f)
.setRecenterMode(RenderableSource.RecenterMode.ROOT)

Expand Down
Loading