Start a new topic

Trial License Code Won't Compile

Trial License Code Won't Compile


I am using theWikitude Epson SDK 4.0.3 with Android Studio and trying to follow the setup Guide. When I paste the following code into my MainActivity.java I get a build error saying the symbol StartupConfiguration cant be found. The application builds fine before I paste the lincense code in.  I declared a varible above "private ArchitectView architectView;".  Any suggestons would be greatly appreciated! Thank you.

This is the license code causing the build problems:

this.architectView = (ArchitectView) this.findViewById( R.id.architectView );

final StartupCnfiguration config = StartupCofiguration( "" /*license key */);

this.architectViw.onCreate( cnfig );

ERROR Code Copied from Android Studio after trying to build:

Information:Gradle tasks
:clean
:app:clean
:app:preBuild UP-TO-DATE
:app:preDebugBuild UP-TO-DATE
:app:checkDebugManifest
:app:preReleaseBuild UP-TO-DATE
:app:prepareComAndroidSupportAnimatedVectorDrawable2340Library
:app:prepareComAndroidSupportAppcompatV72340Library
:app:prepareComAndroidSupportSupportV42340Library
:app:prepareComAndroidSupportSupportVectorDrawable2340Library
:app:prepareDebugDependencies
:app:compileDebugAidl
:app:compileDebugRenderscript
:app:generateDebugBuildConfig
:app:mergeDebugShaders
:app:compileDebugShaders
:app:generateDebugAssets
:app:mergeDebugAssets
:app:generateDebugResValues UP-TO-DATE
:app:generateDebugResources
:app:mergeDebugResources
:app:processDebugManifest
:app:processDebugResources
:app:generateDebugSources
:app:preDebugAndroidTestBuild UP-TO-DATE
:app:prepareDebugAndroidTestDependencies
:app:compileDebugAndroidTestAidl
:app:processDebugAndroidTestManifest
:app:compileDebugAndroidTestRenderscript
:app:generateDebugAndroidTestBuildConfig
:app:mergeDebugAndroidTestShaders
:app:compileDebugAndroidTestShaders
:app:generateDebugAndroidTestAssets
:app:mergeDebugAndroidTestAssets
:app:generateDebugAndroidTestResValues UP-TO-DATE
:app:generateDebugAndroidTestResources
:app:mergeDebugAndroidTestResources
:app:processDebugAndroidTestResources
:app:generateDebugAndroidTestSources
:app:preDebugUnitTestBuild UP-TO-DATE
:app:prepareDebugUnitTestDependencies
:app:mockableAndroidJar
:app:incrementalDebugJavaCompilationSafeguard
:app:compileDebugJavaWithJavac
:app:compileDebugJavaWithJavac - is not incremental (e.g. outputs have changed, no previous execution, etc.).
C:Users\pmbi002\AndroidStudioProjects\Test2\app\src\main\java\com\example\pmbi002\test2\MainActivity.java
Error:(22, 15) error: cannot find symbol class StartupConfiguration
Error:(22, 49) error: cannot find symbol class StartupConfiguration
:app:compileDebugJavaWithJavac FAILED
Error:Execution failed for task ':app:compileDebugJavaWithJavac'.
> Compilation failed; see the compiler error output for details.
Information:BUILD FAILED
Information:Total time: 33.233 secs
Information:3 errors
Information:0 warnings
Information:See complete output in console

Hello Mariah,

Please have a look at the AbstractArchitectCamActivity.java in the epson sampleapp. 

this.architectView = (ArchitectView)this.findViewById( this.getArchitectViewId()  );



/* pass SDK key if you have one, this one is only valid for this package identifier and must not be used somewhere else */

final ArchitectConfig config = new ArchitectConfig( this.getWikitudeSDKLicenseKey() );


try {

/* first mandatory life-cycle notification */

this.architectView.onCreate( config );

}




Also we are currently working on releasing our new epson sdk soon so keep in touch for new updates!

Eva, Thank you for getting back to me. I implemented the sugessted code and looked at the AbstractArchitectCamActivity.java. I am trying to pass the license key into getWikitudeSDKLicenseKey() as a string, but the the method is cannot be found. I am also getting an error for .getArchitectViewId() . Below is my code for MainActivity.java. I apprciate your assistance with this matter.



 

package com.example.myusername.code;

import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.util.Log;
import android.widget.Toast;

import com.example.pmbi002.test2.R;
import com.wikitude.architect.ArchitectView;

public class MainActivity extends AppCompatActivity {
private ArchitectView architectView;
/* I am inserting trial license key below */
public String LicenseKey = " ";

@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);

this.architectView = (ArchitectView)this.findViewById( this.getArchitectViewId() );

/* pass SDK key if you have one, this one is only valid for this package identifier and must not be used somewhere else */

final ArchitectView.ArchitectConfig config = new ArchitectView.ArchitectConfig( this.getWikitudeSDKLicenseKey(LicenseKey) );

try {

/* first mandatory life-cycle notification */

this.architectView.onCreate( config );

} catch (RuntimeException rex) {
this.architectView = null;
Toast.makeText(getApplicationContext(), "can't create Architect View", Toast.LENGTH_SHORT).show();
Log.e(this.getClass().getName(), "Exception in ArchitectView.onCreate()", rex);
}
}

}


 

 

The methods 

 - getWikitudeSDKLicenseKey()

- getArchitectViewId()

are just abstract methods in our sample code which are implemented by the SampleCamActivity.

You can replace those by just entering the licence key and architectView id directly as described below.

 

fixed code:

package com.example.myusername.code;

import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.util.Log;
import android.widget.Toast;



import com.example.pmbi002.test2.R;
import com.wikitude.architect.ArchitectView;


public class MainActivity extends AppCompatActivity {
    private ArchitectView architectView;
    /* I am inserting trial license key below */
    public String LicenseKey = " ";

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);


        this.architectView = (ArchitectView)this.findViewById( R.id.architectView ); // Just set it directly to the id of the ArchitectView as defined in the activity_main layout






/* pass SDK key if you have one, this one is only valid for this package identifier and must not be used somewhere else */

        final ArchitectView.ArchitectConfig config = new ArchitectView.ArchitectConfig( *INSERT LICENCE KEY HERE* ); // You can just insert the licence key directly.

        try {

/* first mandatory life-cycle notification */

            this.architectView.onCreate( config );

        } catch (RuntimeException rex) {
            this.architectView = null;
            Toast.makeText(getApplicationContext(), "can't create Architect View", Toast.LENGTH_SHORT).show();
            Log.e(this.getClass().getName(), "Exception in ArchitectView.onCreate()", rex);
        }
    }


}

 

Thank you! I appreciate your quick reply. That fixed the license key errors. I have one remaining error when I try to run the app. I pasted the error below and a copy of my build.gradle file.    Thanks

ERROR:

Error:Execution failed for task ':app:transformResourcesWithMergeJavaResForDebug'.
> com.android.build.api.transform.TransformException: com.android.builder.packaging.DuplicateFileException: Duplicate files copied in APK sdk_logo-1.png
 File1: C:Users\myusername\AndroidStudioProjects\Test2\app\libs\wikitudesdk.jar
 File2: C:\Users\myusername\AndroidStudioProjects\Test2\app\libs\wikitudesdk.jar

 

Build.Gradle File:

apply plugin: 'com.android.application'

android {
compileSdkVersion 23
buildToolsVersion "24.0.0"

defaultConfig {
applicationId "com.example.pmbi002.test2"
minSdkVersion 15
targetSdkVersion 23
versionCode 1
versionName "1.0"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}

dependencies {
compile fileTree(dir: 'libs', include: )
testCompile 'junit:junit:4.12'
compile(name: 'wikitudesdk', ext: 'jar')
compile 'com.android.support:appcompat-v7:23.4.0'
compile 'com.google.android.gms:play-services-appindexing:8.1.0'
}

repositories {
flatDir{
dirs 'libs'
}
}


 

 

 


I
Login or Signup to post a comment