We are having a trouble running gradlew build. Our app is based on webview. When we run gradle build in cli, a following error constantly pops up
C:\app_n\app\src\main\java\com\example\app\MainActivity.java:3 error ';'
expected import Android.extras.android.m2repository.com.android.support.
appcompat-v7 error:app:compileDegugJavawithJavac failed.
Since the error seems to refer towards MainActivity.java file. Here is the entire code of that page.
package com.example.app;
import android.extras.android.m2repository.com.android.support.appcompat-v7;
import android.os.Bundle;
public class MainActivity extends AppCompatActivity {
@Override protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
Intent i = new Intent(Intent.ACTION_VIEW, Uri.parse("ecitizen.in/")); //
Starts Implicit Activity startActivity(i);
}
}
We have already downloaded the entire android support repository. Our requirement is appcompat function which is required for using this code
Intent i = new Intent(Intent.ACTION_VIEW, Uri.parse("ecitizen.in/"));
Imports are case-sensitive, and this particular import doesn't make any sense:
import Android.extras.android.m2repository.com.android.support.appcompat-v7;
I'm not sure what you're trying to achieve with this, as it looks like you're trying to import the entire support v7 library. From what you've posted in the comments it looks like you're using AppCompatActivity
, so your import should be this instead:
import android.support.v7.app.AppCompatActivity;
You're also missing the import for your resources, so your Activity would not be able to load your layout file:
import com.example.app.R;
Assuming you're coding this in Android studio, you can import any missing dependencies by moving the carat to the part highlighted in red, pressing alt + enter, and selecting Import Class.