I hope one of you can help me. Unfortunately I did not find any help on existing issues and I am a newbie in Android Studio. So i followed this tutorial https://www.youtube.com/watch?v=JgcB6tMi0qE but didnt get the same result: the backgorund on my phone when I run the project is white instead of video-see-through. I looked the sample project up from wikitude and wanted to include the camera projects from the sample in the Main Acitivy on my project. When I run the project I get the following Errors: [Errors][1]
I see that the project cannot load the packages, but I added them in the com path and in an library path. Other imports in the same path have no problem, so I dont understand the problem. This is the MainActivtiy.java Code:
package com.casar.myapplication;
import android.hardware.camera2.CameraManager;
import android.os.Bundle;
import android.view.WindowManager;
import androidx.appcompat.app.AppCompatActivity;
import com.wikitude.NativeStartupConfiguration;
import com.wikitude.WikitudeSDK;
import com.wikitude.camera.CameraManager;
import com.wikitude.camera.CameraManagerListener;
import com.wikitude.common.WikitudeError;
import com.wikitude.common.camera.CameraSettings;
import com.wikitude.architect.ArchitectStartupConfiguration;
import com.wikitude.architect.ArchitectView;
import com.wikitude.common.camera.CameraSettings;
import com.wikitude.samples.WikitudeSDKConstants;
import com.wikitude.samples.camera.CameraSettingsActivity;
import static com.casar.myapplication.R.id;
import static com.casar.myapplication.R.layout;
public class MainActivity extends AppCompatActivity {
private ArchitectView architectView;
private WikitudeSDK wikitudeSDK;
private CameraManager cameraManager;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(layout.activity_main);
this.architectView = (ArchitectView)this.findViewById(id.architectView);
final ArchitectStartupConfiguration config = new ArchitectStartupConfiguration();
config.setLicenseKey("*****HERE IS MY KEY*****");
this.architectView.onCreate( config );
camera2Enabled = getIntent().getBooleanExtra("enableCamera2", true);
wikitudeSDK = new WikitudeSDK(this);
NativeStartupConfiguration startupConfiguration = new NativeStartupConfiguration();
startupConfiguration.setLicenseKey(WikitudeSDKConstants.WIKITUDE_SDK_KEY);
startupConfiguration.setCameraPosition(CameraSettings.CameraPosition.BACK);
startupConfiguration.setCameraResolution(CameraSettings.CameraResolution.AUTO);
wikitudeSDK.onCreate(getApplicationContext(), this, startupConfiguration);
cameraManager = wikitudeSDK.getCameraManager();
cameraManager.setListener(this);
final TargetCollectionResource targetCollectionResource = wikitudeSDK.getTrackerManager().createTargetCollectionResource("file:///android_asset/magazine.wtc");
wikitudeSDK.getTrackerManager().createImageTracker(targetCollectionResource, CameraSettingsActivity.this, null);
getWindow().addFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON);
}
@Override
protected void onPostCreate(Bundle savedInstanceState) {
super.onPostCreate(savedInstanceState);
this.architectView.onPostCreate();
}
@Override
protected void onResume() {
super.onResume();
this.architectView.onResume();
}
@Override
protected void onDestroy() {
super.onDestroy();
this.architectView.onDestroy();
}
@Override
protected void onPause() {
super.onPause();
this.architectView.onPause();
}
}
Here is the java path structure: [structure java dir][2]
In other questions I found out that the build:gradle is important, so here is my code of that:
plugins {
id 'com.android.application'
}
android {
compileSdkVersion 30
defaultConfig {
applicationId "com.casar.myapplication"
minSdkVersion 22
targetSdkVersion 30
versionCode 1
versionName "1.0"
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
}
}
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
}
dependencies {
implementation 'androidx.appcompat:appcompat:1.2.0'
implementation 'com.google.android.material:material:1.2.1'
implementation 'androidx.constraintlayout:constraintlayout:2.0.4'
implementation project(path: ':mylibrary')
testImplementation 'junit:junit:4.+'
androidTestImplementation 'androidx.test.ext:junit:1.1.2'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.3.0'
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation 'com.wikitude:js:9.4.0'
//noinspection GradleCompatible
implementation 'com.android.support:appcompat-v7:27.1.0'
implementation 'com.google.ar:core:1.15.0'
}
repositories {
flatDir{
dirs 'libs'
}
}
Do you need any other information? I will happily provide you with everything and I hope someone can help! Greetings! [1]: https://i.stack.imgur.com/cov3s.png [2]: https://i.stack.imgur.com/Etb3D.png
You need to remove implementation fileTree(dir: 'libs', include: ['*.jar']) You have mentioned implementation 'com.wikitude:js:9.4.0' so no need to add libs folder. Then sync and try to rebuild the project.