I am trying to start a project using PocketSphinx resources. What is the method for importing PocketSphinx resources into my Android Studio workspace?
import edu.cmu.pocketsphinx.Assets; //"unused import statement"
import edu.cmu.pocketsphinx.Hypothesis; //"unused import statement"
import edu.cmu.pocketsphinx.RecognitionListener; //"unused import statement"
import edu.cmu.pocketsphinx.SpeechRecognizer; //"unused import statement"
import edu.cmu.pocketsphinx.SpeechRecognizerSetup; //"unused import statement"
public class MainActivity extends AppCompatActivity implements RecognitionListener {...
As expected, I am getting a, "Cannot resolve symbol 'RecognitionListener' " on the last line. Thanks in advance.
The library is distributed as an Android Archive (AAR). Download from https://github.com/cmusphinx/pocketsphinx-android-demo/blob/master/aars/pocketsphinx-android-5prealpha-release.aar
Move pocketsphinx-android-5prealpha-release.aar into helloworld/app/lib/ directory.
In Android Studio go to File > New > New module, scroll down and choose Import .JAR/.AAR Package. Browse to /app/lib and select the .aar file. Click "Okay". Keep the apps module selected, click dependencies tab, click "+" on far right side, choose "Module Dependency". Select Module and click "Okay". For further information go to How to manually include external aar package using new Gradle Android Build System, scroll to Oliver Kranz's answer for nice screen grabs of the process.
Related
I want to use a class (BitSet) form the kotlin.native package (https://kotlinlang.org/api/latest/jvm/stdlib/kotlin.native/-bit-set/)
Android Studio adds an import from java.util.* witch is not equivalent to BitSet from kotlin.native, I cannot for example get the property lastTrueIndex from java.util.BitSet
How can I add the kotlin.native package to my project ?
The old project name was expense_calculator.
Then I renamed the project to a different name, but somewere the old name still present, so when I import a package in Android Studio it substitutes the old name in imports, like
import 'dart:io';
import 'package:downloads_path_provider/downloads_path_provider.dart';
import 'package:expensecalculator/models/entry.dart';
import 'package:expensecalculator/models/entry_list_model.dart';
import 'package:flutter/material.dart';
...
How can I change all of the names throughout the whole project?
You have to change the package name parameter in the pubspec.yaml file to whatever new name you want. Then the imports will use the new name.
Facing issue when add copied code from stack-overflow into the android studio and android studio's auto import functionality imports android.R package even if it is already imported with our app package name.
Here is steps to reproduce issue.
1) Copy any code from stack-overflow. For example,
Intent i = new Intent(Intent.ACTION_SEND);
2) Paste it over android studio and below is the output when auto-import performs their operation.
Above statement will automatically import android.R package even if R file not contains R file.
If anyone can help it would be great!
I'm trying to make flappy bird equivalent app using AndEngine. I'm having trouble importing AndEnginePhysicsBox2DExtension-GLES2 module in Android Studio 1.5
So far, I have imported AndEngine-GLES2 as module by
Project Structures -> green + sign on left top -> import Eclipse ADP -> selecting path
to AndEngine-GLES2 source.
For some reason when I try this for AndEnginePhysicsBox2DExtension-GLES2, it doesn't recognize it as module therefore I can't import it. I'm not using JAR FYI.
step 4 in here doesn't help as I can't import AndEnginePhysicsBox2DExtension-GLES2, at all.
You have to remove "-GLES2" from folders names.
Other solution could be: File -> New -> Import project -> Select AndEnginePhysicsBox2DExtension and save the project.
Then import the module from project structure...
For both libraries do the following:Go to project strukture -> modules-> button + import module from existing sources.
Then click on your module, switch to dependencies bookmark and add Andengine and physics extenstion imported modules.
Then click on Andengine project and add dependency to Physics extension module.
When ever I start a new project to practice using Android Studio the following
imports are added by default:
import android.support.v7.app.ActionBarActivity;
import android.os.Bundle;
import android.view.Menu;
import android.view.MenuItem;
As soon as I start adding another import to follow an example from a book or tutorial the whole new line disappears. If I add lines without the semicolon nothing happens. As soon as I begin adding the semicolons the new lines start disappearing. Why is this happening?
AndroidStudio auto "organizes" your imports. Just start adding your code and it will add the imports that you need. If you want to toggle this off, which I don't recommend, it's in: Preferences -> Editor(Under IDE Settings) -> General -> Auto Import