Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 3331282
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 17, 20262026-05-17T23:34:12+00:00 2026-05-17T23:34:12+00:00

Probably a simple question but I’ve developed an app that has always been using

  • 0

Probably a simple question but I’ve developed an app that has always been using a build target of 1.5 without issue. However, now I’m adding TextToSpeech which was introduced in 1.6. I’ve created a TextToSpeech wrapper that encapsulates the TextToSpeech code and I have checks in the activity so that when it does run, it should only work for 1.6 devices and above. But the trick is to get the code to run in Eclipse with a build target of 1.5. When I try to do that, of course, I get the following errors tied to my TextToSpeech wrapper class:

“TextToSpeech cannot be resolved.”

I’ve played around with exporting as jar, creating a library project, etc. but I cannot seem to get those to work. For a library project, it says that dependent projects must have the same or higher API level so it won’t work. Some relevant code excerpts:

AndroidManifest.xml

 <uses-sdk 
  android:minSdkVersion="3"
  android:targetSdkVersion="8"
  />

activity class

static {
      try {
        TextToSpeechWrapper.checkAvailable();
        androidTextToSpeechAvailable = true;
      } catch (Throwable t) {
        androidTextToSpeechAvailable = false;
      }
    }

wrapper class

import java.util.HashMap;
import java.util.Locale;

import android.content.Context;
import android.speech.tts.TextToSpeech;

/*
 * A wrapper class for the newer Android text-to-speech library that is only found in
 * Android OS 1.6 and above (Donut and above).  This is useful so that the app can
 * be loaded on pre-Donut devices without breaking the app.
 */
public class TextToSpeechWrapper {

  private TextToSpeech mTextToSpeech;

  // class initialization fails when this throws an exception
  static {
    try {
      Class.forName("android.speech.tts.TextToSpeech");
    } catch (Exception e) {
      throw new RuntimeException(e);
    }
  }

  // Some static vars from the text-to-speech class
  public static int SUCCESS = TextToSpeech.SUCCESS;
  public static int QUEUE_FLUSH = TextToSpeech.QUEUE_FLUSH;  <--- Eclipse errors point here cause it does not exist in 1.5.

So my question is how do I make the project use a build target of 1.5 again w/ the emulator so I can test and feel confident my app still works for 1.5 and above?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-17T23:34:12+00:00Added an answer on May 17, 2026 at 11:34 pm

    If your purpose is to test your app on a 1.5 device/AVD, the you could try to build it against Android 1.6 (API level 4) and set minSdkVersion=3 in your manifest. I’m not sure, but I think you should be able to run it on an Android 1.5 (API level 3) device this way. If this doesn’t work, I have another solution, but it’s a bit more complicated so let me know if you need it and I’ll explain it to you.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Probably simple question but it has been a long time since i work with
This is probably a simple question but I am developing a web app in
Hi probably quite a simple question but.. When plotting a graph using matplotlib.pyplot my
This is probably a very simple question for some, but it has me stumped.
This is probably a very simple question for some, but it has me stumped.
This is probably a simple question but i've been unable to find a quick
This is probably a simple question but I am not an ASP.NET developer and
This is probably a simple question but I can't seem to find the solution.
This is probably a really simple question but... I would like to do a
This is probably a simple question, and I'm slightly embarrassed to ask it, but

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.