Reputation: 1324
I have an eclipse Cordova project that I am trying to import into Android Studio. I have imported it as a gradle project and got the build.gradle files working properly.
There are 2 projects (kind of). My MainActivity (com.test.example) and CordovaLib which is imported.
However, when I try to add a module, it only allows me to use CordovaLib. As a result, the project never runs from the main activity. I have no idea how to get it to run the main project.
My settings and project set up are below
FOR SOME REASON I CANNOT UPLOAD IMAGES THROUGH STACKOVERFLOW
My root build.gradle file
// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
repositories {
mavenCentral()
}
dependencies {
classpath 'com.android.tools.build:gradle:2.3.1'
}
}
allprojects {
repositories {
mavenCentral()
}
}
apply plugin: 'com.google.gms.google-services'
My CordovaLib build.gradle file
apply plugin: 'com.android.application'
android {
compileSdkVersion 23
buildToolsVersion '25.0.2'
defaultConfig {
applicationId 'example.com.test'
minSdkVersion 21
targetSdkVersion 23
versionCode 24
versionName '1.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')
}
}
dependencies {
compile fileTree(dir: 'libs', include: '*.jar')
}
apply plugin: 'base'
My settings.gradle root file
// GENERATED FILE - DO NOT EDIT
include ":"
include ":CordovaLib"
When i try to run the project i get the following error
Error running CordovaLib: Default Activity Not Found
Any idea what I am doing wrong? I don't know if the build.gradle files have been muddles up, or if i'm going about this the total wrong way. Had nothing but bother for the past few days
Upvotes: 1
Views: 454
Reputation: 528
step by step import with above link
and this error Error running CordovaLib: Default Activity Not Found when occur there is no default activity set in android manifest check android mainfest of library that you import.
hope it help.
Upvotes: 1