AndroidApplicationConfiguration无法在Android Studio中解析
我在Android Stuio项目中使用libgdx和OpenCV。但是,AndroidApplicationConfiguration无法在Android Studio中解析,android,libgdx,Android,Libgdx,我在Android Stuio项目中使用libgdx和OpenCV。但是,android应用程序配置无法解析。这些库没有被解析。在我的build.gradle中,我使用了以下版本的库: implementation "com.badlogicgames.gdx:gdx:0.9.9" implementation "com.badlogicgames.gdx:gdx-box2d:0.9.9" implementation "com.badlogicgames.gdx:gdx-fre
android应用程序配置
无法解析。这些库没有被解析。在我的build.gradle中,我使用了以下版本的库:
implementation "com.badlogicgames.gdx:gdx:0.9.9"
implementation "com.badlogicgames.gdx:gdx-box2d:0.9.9"
implementation "com.badlogicgames.gdx:gdx-freetype:0.9.9"
代码:
可能该类在v0.9.9中不可用。帮自己一个忙,使用1.9.8
看看你的build.gradle,我看到Android后端依赖项被注释掉了(并且不是通过gradle提取的)。你是如何产生这个项目的?我建议使用生成一个新的项目,并使用它修复项目配置。添加您的build.gradle我已经添加了build.gradle
import com.badlogic.gdx.backends.android.AndroidApplication;
import com.badlogic.gdx.backends.android.AndroidApplicationConfiguration
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
//load preferences
mPreferences = new UserPreferences(this);
GridSize mGridSize = new GridSize(mPreferences.getLat(), mPreferences.getLon());
mSettingsControl.setGridSize(mGridSize);
mCameraControl = new CameraSurface(this, mSettingsControl);
//getting camera surface view
SurfaceView mSurfaceView = mCameraControl.getSurface();
FrameLayout layout = new FrameLayout(getContext());
//crating main view from activity_main layout
View mainView = LayoutInflater.from(getContext()).inflate(R.layout.activity_main, layout, false);
// setting up sensors
orientationProvider = new ImprovedOrientationSensor2Provider(this, (SensorManager) getContext().getSystemService(SENSOR_SERVICE));
//creating and configuring new instance of LibGDX spherical view
AndroidApplicationConfiguration cfg = new AndroidApplicationConfiguration();
cfg.useGyroscope = true;
cfg.useAccelerometer = false;
cfg.useCompass = false;
cfg.r = 8;
cfg.g = 8;
cfg.b = 8;
cfg.a = 8;
AndroidCamera androidCamera = new AndroidCamera(rotationVector, mCameraControl.getSphereControl(), mSettingsControl);
mManualControl = androidCamera;
//initializing LibGDX spherical view
initializeForView(androidCamera, cfg);
if (graphics.getView() instanceof GLSurfaceView) {
LOG.s(TAG, "creating layout");
GLSurfaceView glView = (GLSurfaceView) graphics.getView();
glView.setZOrderMediaOverlay(true);
glView.getHolder().setFormat(PixelFormat.TRANSLUCENT);
glView.setKeepScreenOn(true);
layout.addView(mSurfaceView);
layout.addView(glView);
layout.addView(mainView);
}
//attach layout to view
setContentView(layout);
//injecting view components
ButterKnife.bind(this);
NavigationView navigationView = findViewById(R.id.nav_view);
navigationView.setNavigationItemSelectedListener(this);
//delete files from temporary picture folder
ImageRW.deleteTempFiles();
ImageRW.deletePartFiles();
mPicturePosition = PicturePosition.getInstance(mGridSize.getLAT(), mGridSize.getLON(), true);
imageHandler = new Thread(new Runnable() {
public synchronized void run() {
LOG.s(TAG, "image handler call");
while (mRunning) {
try {
wait(500);
} catch (InterruptedException ex) {
ex.printStackTrace();
}
List<Integer> newImagePart = ImagePicker.loadPanoParts(mPicturePosition);
if (newImagePart.size() == 3) {
Message message = new Message();
message.what = PROCESS_PART_IMAGES;
mPicturePosition.markAsUsed(newImagePart);
Bundle data = new Bundle();
int id = imageCount++;
message.arg1 = id;
data.putIntegerArrayList(PART + id, (ArrayList<Integer>) newImagePart);
message.setData(data);
threadHandler.sendMessage(message);
}
}
}
});
}
dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation 'com.android.support:appcompat-v7:28.0.0'
implementation 'com.android.support:cardview-v7:28.0.0'
implementation 'com.android.support:recyclerview-v7:28.0.0'
implementation 'com.android.support:design:28.0.0'
implementation "com.badlogicgames.gdx:gdx:1.9.9"
implementation "com.badlogicgames.gdx:gdx-box2d:1.9.9"
implementation "com.badlogicgames.gdx:gdx-freetype:1.9.9"
implementation "net.dermetfan.libgdx-utils:libgdx-utils:0.13.4"
implementation "net.dermetfan.libgdx-utils:libgdx-utils-box2d:0.13.4"
testImplementation 'junit:junit:4.12'
testImplementation "org.mockito:mockito-core:2.13.0"
//ButterKnife
implementation 'com.jakewharton:butterknife:8.8.1'
annotationProcessor 'com.jakewharton:butterknife-compiler:8.8.1'
implementation 'com.android.support.constraint:constraint-layout:1.1.3'
testImplementation 'junit:junit:4.12'
androidTestImplementation 'com.android.support.test:runner:1.0.2'
androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.2'
implementation project(path: ':opencv-java')
implementation project(path: ':core')
// implementation files('libs/gdx-backend-android.jar')
// implementation files('C:\\Users\\Atif\\AndroidStudioProjects\\PanShoot\\app\\libs\\gdx-backend-android.jar')
}