3

I started with a new project. Imported a new module like this File -> New -> Import Module-> Source Directory.

Now the module that I imported has a dependency also. So two modules got imported.Then I added the main module as library like this File -> Project Structure -> Dependencies Tab -> Click on Plus -> Add module dependency and then click ok.

Now since I have include library modules. I got this error. So I added the multiDexEnabled:true property and now my gradle looks like this.

After that error I found another error Error:Execution failed for task ':app:transformClassesWithJarMergingForDebug'.

com.android.build.api.transform.TransformException: java.util.zip.ZipException: duplicate entry: android/support/v4/util/TimeUtils.class

Which I solved by adding the below line of code (This line has been included in the earlier image of manifest file)

configurations {
        all*.exclude group: 'com.android.support', module: 'support-v4'
    }

Now after all these steps when I try to run the MainActvity then i get the following error (title) java.lang.NoClassDefFoundError: android.support.v7.app.AppCompatDelegateImplV14

This how my Log Cat looks.

Manifest and project structure

Manifest

Theme looks like this Theme

Main Activity

import android.content.res.Resources;
import android.support.annotation.NonNull;
import android.support.v7.app.ActionBarActivity;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.util.TypedValue;
import android.view.MenuItem;
import android.view.ViewGroup;
import android.widget.ListView;

import com.ascentbrezie.deleteapp.R;
import com.ascentbrezie.deleteapp.adapters.GoogleCardsMediaAdapter;
import com.nhaarman.listviewanimations.appearance.simple.SwingBottomInAnimationAdapter;
import com.nhaarman.listviewanimations.itemmanipulation.swipedismiss.OnDismissCallback;
import com.nhaarman.listviewanimations.itemmanipulation.swipedismiss.SwipeDismissAdapter;


public class MainActivity extends AppCompatActivity implements
        OnDismissCallback {

    private static final int INITIAL_DELAY_MILLIS = 300;

    private GoogleCardsMediaAdapter mGoogleCardsAdapter;

    @Override
    protected void onCreate(final Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.list_view);

        ListView listView = (ListView) findViewById(R.id.list_view);

        listView.setBackgroundResource(R.drawable.background_media);

        mGoogleCardsAdapter = new GoogleCardsMediaAdapter(this,
                com.ascentbrezie.deleteapp.utils.DummyContent.getDummyModelList());
        SwingBottomInAnimationAdapter swingBottomInAnimationAdapter = new SwingBottomInAnimationAdapter(
                new SwipeDismissAdapter(mGoogleCardsAdapter,this));
        swingBottomInAnimationAdapter.setAbsListView(listView);

        assert swingBottomInAnimationAdapter.getViewAnimator() != null;
        swingBottomInAnimationAdapter.getViewAnimator().setInitialDelayMillis(
                INITIAL_DELAY_MILLIS);

        listView.setClipToPadding(false);
        listView.setDivider(null);
        Resources r = getResources();
        int px = (int) TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP,
                8, r.getDisplayMetrics());
        listView.setDividerHeight(px);
        listView.setFadingEdgeLength(0);
        listView.setFitsSystemWindows(true);
        px = (int) TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, 12,
                r.getDisplayMetrics());
        listView.setPadding(px, px, px, px);
        listView.setScrollBarStyle(ListView.SCROLLBARS_OUTSIDE_OVERLAY);
        listView.setAdapter(swingBottomInAnimationAdapter);

//        getSupportActionBar().setDisplayHomeAsUpEnabled(true);
//        getSupportActionBar().setTitle("Google cards media");
    }

    @Override
    public boolean onOptionsItemSelected(MenuItem item) {
        if (item.getItemId() == android.R.id.home) {
            finish();
            return true;
        }
        return super.onOptionsItemSelected(item);
    }

    @Override
    public void onDismiss(@NonNull final ViewGroup listView,
                          @NonNull final int[] reverseSortedPositions) {
        for (int position : reverseSortedPositions) {
            mGoogleCardsAdapter.remove(mGoogleCardsAdapter.getItem(position));
        }
    }
}

Now I am stuck and not able to move forward. I have tried some solutions on stack overflow but couldn't solve it. Thanx for the help

Community
  • 1
  • 1
jigar
  • 49
  • 2

0 Answers0