0

Good morning,

I've run into quite a lot of issues when it comes to setting up my Android dependencies in Eclipse.

Since having fixed the original errors (dependancies) I've now bumped into some new ones that don't seem to be occuring due to the previous XML and targetSDK errors, but something else.

I've got a simple app in mind that I wish to create, however it requires me to use the google maps api and I've since the beginning of this week basically been struggling with setting up the dependencies correctly.

I've done everything from re-installing the ADT, SDKs, extras and much much more - but to no avail. I've followed the tutorial on google's dev regarding the android environments.

Current error:

  Description   Resource    Path    Location    Type
FragmentActivity cannot be resolved to a type   Startup.java    /birdview/src/com/example/birdview  line 14 Java Problem
FragmentActivity cannot be resolved to a type   Startup.java    /birdview/src/com/example/birdview  line 19 Java Problem
FragmentActivity cannot be resolved to a type   Startup.java    /birdview/src/com/example/birdview  line 42 Java Problem
The method getFragmentManager() is undefined for the type Startup   Startup.java    /birdview/src/com/example/birdview  line 22 Java Problem
The method getMenuInflater() is undefined for the type Startup  Startup.java    /birdview/src/com/example/birdview  line 29 Java Problem
The method onCreate(Bundle) of type Startup must override or implement a supertype method   Startup.java    /birdview/src/com/example/birdview  line 18 Java Problem
The method onCreateOptionsMenu(Menu) of type Startup must override or implement a supertype method  Startup.java    /birdview/src/com/example/birdview  line 27 Java Problem
The method onOptionsItemSelected(MenuItem) of type Startup must override or implement a supertype method    Startup.java    /birdview/src/com/example/birdview  line 34 Java Problem
The method setContentView(int) is undefined for the type Startup    Startup.java    /birdview/src/com/example/birdview  line 20 Java Problem
Unable to resolve target 'android-19' until the SDK is loaded.  hello       Unknown Android Target Problem
Unable to resolve target 'android-21' until the SDK is loaded.  birdview        Unknown Android Target Problem
Unable to resolve target 'android-21' until the SDK is loaded.  google-play-services_lib        Unknown Android Target Problem

Since changing the targetSDK the dependancy errors are now gone, however the above error has taken its place.

I've attempted to remove the project, re-adding it. Also attempted re-installing the tools in case those were messing with me.

I'm not really sure what more code etc that you guys would require to help me, so please do go ahead and tell me if you need more snippets.

Any help regarding this issue would be greatly appriciated.

Best regards, Joakim

EDIT (Gradle file):

    apply plugin: 'com.android.application'

dependencies {
    compile fileTree(dir: 'libs', include: '*.jar')
    compile project(':google-play-services_lib')
}

android {
    compileSdkVersion 21
    buildToolsVersion "23.0.2"

    sourceSets {
        main {
            manifest.srcFile 'AndroidManifest.xml'
            java.srcDirs = ['src']
            resources.srcDirs = ['src']
            aidl.srcDirs = ['src']
            renderscript.srcDirs = ['src']
            res.srcDirs = ['res']
            assets.srcDirs = ['assets']
        }

        // Move the tests to tests/java, tests/res, etc...
        instrumentTest.setRoot('tests')

        // Move the build types to build-types/<type>
        // For instance, build-types/debug/java, build-types/debug/AndroidManifest.xml, ...
        // This moves them out of them default location under src/<type>/... which would
        // conflict with src/ being used by the main source set.
        // Adding new build types or product flavors should be accompanied
        // by a similar customization.
        debug.setRoot('build-types/debug')
        release.setRoot('build-types/release')
    }
}

EDIT:

    package com.example.birdview;

import com.google.android.gms.maps.GoogleMap;
import com.google.android.gms.maps.OnMapReadyCallback;

import android.app.Fragment;
import android.os.Bundle;
import android.view.LayoutInflater;
import android.view.Menu;
import android.view.MenuItem;
import android.view.View;
import android.view.ViewGroup;

public class Startup extends FragmentActivity 
implements OnMapReadyCallback {

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_startup);
        if (savedInstanceState == null) {
            getFragmentManager().beginTransaction().add(R.id.container, new PlaceholderFragment()).commit();
        }
    }

    @Override
    public boolean onCreateOptionsMenu(Menu menu) {
        // Inflate the menu; this adds items to the action bar if it is present.
        getMenuInflater().inflate(R.menu.startup, menu);
        return true;
    }

    @Override
    public boolean onOptionsItemSelected(MenuItem item) {
        // Handle action bar item clicks here. The action bar will
        // automatically handle clicks on the Home/Up button, so long
        // as you specify a parent activity in AndroidManifest.xml.
        int id = item.getItemId();
        if (id == R.id.action_settings) {
            return true;
        }
        return super.onOptionsItemSelected(item);
    }

    /**
     * A placeholder fragment containing a simple view.
     */
    public static class PlaceholderFragment extends Fragment {

        public PlaceholderFragment() {
        }

        @Override
        public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
            View rootView = inflater.inflate(R.layout.fragment_startup, container, false);
            return rootView;
        }
    }

    @Override
    public void onMapReady(GoogleMap googleMap) {
        // TODO Auto-generated method stub

    }
}

Edit: Still need assistance.

Todai
  • 164
  • 9

2 Answers2

0

add latest support and design dependency and rebuild your project

compile 'com.android.support:design:23.1.1'
compile 'com.android.support:appcompat-v7:23.1.1'
Ravi
  • 34,851
  • 21
  • 122
  • 183
0

It is because of your compiledSdkVersion. You should set it to 21 or higher because @android:style/Theme.Material.Light.DialogWhenLarge.NoActionBar was introduced in API Level 21. See here.

gerardnimo
  • 1,444
  • 8
  • 10
  • That did fix the dependency issue. However now I'm facing various other errors like: "FragmentActivity cannot be resolved to a type". See my edit for my Startup (only activity) for more info. – Todai Feb 12 '16 at 15:58
  • You may want to look at this [SO-164886](http://stackoverflow.com/questions/8164886/fragmentactivity-cannot-be-resolve-to-a-type). – gerardnimo Feb 15 '16 at 08:34