Display scenes in augmented reality

1170
7
10-25-2019 08:28 AM
AlexanderKulikov
New Contributor II


Hi!

An error occurs from the example

dependencies {
    implementation fileTree(dir: 'libs', include: ['*.jar'])
    implementation 'androidx.appcompat:appcompat:1.0.2'
    implementation 'androidx.constraintlayout:constraintlayout:1.1.3'
    testImplementation 'junit:junit:4.12'
    androidTestImplementation 'androidx.test.ext:junit:1.1.0'
    androidTestImplementation 'androidx.test.espresso:espresso-core:3.1.1'
    implementation 'com.esri.arcgisruntime:arcgis-android:100.6.0'
    implementation project(path: ':arcgis-android-toolkit-100.6.0')

    implementation 'org.apache.directory.studio:org.apache.commons.lang:2.6'
    implementation 'com.google.code.gson:gson:2.8.4'

    implementation 'com.android.support:appcompat-v7:28.0.0'
    implementation 'com.android.support.constraint:constraint-layout:1.0.2'
    implementation 'com.android.support:design:28.0.0'
    implementation 'com.android.support:support-v4:28.0.0'

    implementation 'com.google.ar.sceneform.ux:sceneform-ux:1.12.0'

    // Alternatively, use ArSceneView without the UX dependency.
    implementation 'com.google.ar.sceneform:core:1.12.0'

    annotationProcessor "androidx.lifecycle:lifecycle-compiler:2.0.0"
    implementation "androidx.lifecycle:lifecycle-runtime:2.0.0"
    implementation "androidx.lifecycle:lifecycle-extensions:2.0.0"
    implementation "androidx.lifecycle:lifecycle-common-java8:2.0.0"

}
Tags (2)
0 Kudos
7 Replies
LukeDuncan1
New Contributor II

Hi Alexander Kulikov

Would you mind sharing your whole project with us?

The build.gradle file looks to be mixing androidx dependencies and legacy support dependencies, this may be causing the issue you are seeing. You've also included some dependencies that will be transitively included by the toolkit.

Let's try and get the build.gradle file dependencies in order first before we chase down the issue.

Unless you need to make changes to the toolkit, you don't need to include it as a local module like so:

implementation project(path: ':arcgis-android-toolkit-100.6.0')

What I would recommend is removing that line and adding the following:

implementation "com.esri.arcgisruntime:arcgis-android-toolkit:100.6.0"

Please also see the Toolkit Repo for instructions of how to use the components: GitHub - Esri/arcgis-runtime-toolkit-android: ArcGIS Runtime SDK for Android Toolkit 

Luke

0 Kudos
AlexanderKulikov
New Contributor II

Hi Luke!

This solution did not help. 

Unless you need to make changes to the toolkit, you don't need to include it as a local module like so:

implementation project(path: ':arcgis-android-toolkit-100.6.0')

What I would recommend is removing that line and adding the following:

implementation "com.esri.arcgisruntime:arcgis-android-toolkit:100.6.0"

Source project

Thanks for the answer!

0 Kudos
LukeDuncan1
New Contributor II

Hi Alexander Kulikov,

I have pulled down the project you have supplied and it appears to be building correctly.

Please clean and rebuild the project by executing the following in Android Studio:

  • Build -> Clean Project
  • Build -> Rebuild Project

I would also change your dependencies to match the following:

dependencies {
    implementation fileTree(dir: 'libs', include: ['*.jar'])
    implementation 'androidx.appcompat:appcompat:1.0.2'
    implementation 'androidx.constraintlayout:constraintlayout:1.1.3'
    testImplementation 'junit:junit:4.12'
    androidTestImplementation 'androidx.test.ext:junit:1.1.0'
    androidTestImplementation 'androidx.test.espresso:espresso-core:3.1.1'
    implementation "com.esri.arcgisruntime:arcgis-android-toolkit:100.6.0"

    implementation 'org.apache.directory.studio:org.apache.commons.lang:2.6'
    implementation 'com.google.code.gson:gson:2.8.4'

    annotationProcessor "androidx.lifecycle:lifecycle-compiler:2.0.0"
    implementation "androidx.lifecycle:lifecycle-runtime:2.0.0"
    implementation "androidx.lifecycle:lifecycle-extensions:2.0.0"
    implementation "androidx.lifecycle:lifecycle-common-java8:2.0.0"
}
  • I have removed the ArcGIS Runtime Android SDK dependency as it is a transitive dependency of the Toolkit. This helps ensure that you use the correct version with the Toolkit.
  • I have removed the Sceneform dependencies as they are also transitive dependencies of the Toolkit, this will ensure you are using the correct versions that the Toolkit is also using.

Regards,

Luke

0 Kudos
AlexanderKulikov
New Contributor II

Hi Luke!

Сlean up and rebuild the project did not help.

When you click on the button "NAV_BUTTON" crashes with the same error.

Google ArCore is installed on the phone.

Thanks for the answer!

0 Kudos
LukeDuncan1
New Contributor II

Can you provide me with the device you are using and what version of Android it is running?

I tapped the button and received a different error related to a layout inflation when running on OnePlus 7 Pro running Android 10.

Please check that this section in activity_ar.xml is fixed:

<include
    layout="@layout/layout_calibration_controls"
    app:layout_constraintBottom_toTopOf="@+id/calibrateButton"
    app:layout_constraintStart_toStartOf="parent"
    app:layout_constraintEnd_toEndOf="parent"
    android:visibility="gone"/>

Note the @layout added to the layout tag.

Thanks,

Luke

AlexanderKulikov
New Contributor II

Thanks Luke!


Replaced with this markup and everything worked!

<include
    layout="@layout/layout_calibration_controls"
    app:layout_constraintBottom_toTopOf="@+id/calibrateButton"
    app:layout_constraintStart_toStartOf="parent"
    app:layout_constraintEnd_toEndOf="parent"
    android:visibility="gone"/>

0 Kudos
LukeDuncan1
New Contributor II

Great! Glad I could help.

Luke

0 Kudos