从Eclipse的运行Android应用程序到Android工作

从Eclipse的运行Android应用程序到Android工作

本文介绍了异常试图从Eclipse的运行Android应用程序到Android工作室的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我试图迁移一个Eclipse Android项目到Android工作室,我已经从Android的工作室试图左右逢源,开放直接迁移到摇篮在Eclipse,然后再在Android的Studio中打开它。

然后我试图删除谷歌播放库文件夹,并在我的摇篮文件中添加它,然后将项目做到这一点:

  • 请项目确定
  • 清理项目确定
  • 重建项目确定
  • 在摇篮同步和下载大量的DLL 确定
  • 播放或调试KO,给我这样的错误:

我已经开始使用JDK 1.6,然后升级到1.7再到1.8,看看是否是这个问题。

如果我不删除谷歌播放Dervices文件夹中的项目工作得很好。

我使用的是MAC,如果这是非常重要的。

如果这个问题解决了这个问题,我在this在我的项目的其他问题张贴在堆栈溢出。

这是它的外观我的项目结构:

这是所有项目的build.grade文件

主要整经机项目(guestperience 1.0.1蒙克洛亚德圣拉萨罗):

  //顶级构建文件,你可以到各子项目/模块添加常用的配置选项。
buildscript {
    库{
        jcenter()
    }
    依赖{
        类路径com.android.tools.build:gradle:1.2.0
    }
}
 

goSmart.guestperience.MoncloaDeSanLazaro(这是我的code):

 应用插件:com.android.application

依赖{
    编译文件树(导演:库,包括:的* .jar)
    编制项目(:librarySmartHotel)
    编译com.google.android.gms:播放服务:7.3.0
}

安卓{
    compileSdkVersion 16
    buildToolsVersion22.0.1

    sourceSets {
        主要 {
            manifest.srcFile的Andr​​oidManifest.xml
            java.srcDirs = ['src'中]
            resources.srcDirs = ['src'中]
            aidl.srcDirs = ['src'中]
            renderscript.srcDirs = ['src'中]
            res.srcDirs = ['水库']
            assets.srcDirs = ['资产']
        }

        //移动测试,测试/ java中,测试/ RES等...
        instrumentTest.setRoot(测试)

        //将建设各类建设类型/<类型>
        //例如,构建类型/调试/ java中,构建类型/调试/ AndroidManifest.xml中,...
        //这会将他们从src下他们默认位置/<类型> / ...这将
        //与SRC /冲突正在使用的主要来源集中。
        //添加新的构建类型或产品的口味应附有
        //通过类似定制。
        debug.setRoot(集结类型/调试)
        release.setRoot(集结类型/释放)
    }
}
 

librarySmartHotel:

 应用插件:com.android.library

依赖{
    编译文件树(导演:库,包括:的* .jar)
    编制项目(:主)
}

安卓{
    compileSdkVersion 16
    buildToolsVersion '22 .0.1

    sourceSets {
        主要 {
            manifest.srcFile的Andr​​oidManifest.xml
            java.srcDirs = ['src'中]
            resources.srcDirs = ['src'中]
            aidl.srcDirs = ['src'中]
            renderscript.srcDirs = ['src'中]
            res.srcDirs = ['水库']
            assets.srcDirs = ['资产']
        }

        //移动测试,测试/ java中,测试/ RES等...
        instrumentTest.setRoot(测试)

        //将建设各类建设类型/<类型>
        //例如,构建类型/调试/ java中,构建类型/调试/ AndroidManifest.xml中,...
        //这会将他们从src下他们默认位置/<类型> / ...这将
        //与SRC /冲突正在使用的主要来源集中。
        //添加新的构建类型或产品的口味应附有
        //通过类似定制。
        debug.setRoot(集结类型/调试)
        release.setRoot(集结类型/释放)
    }
}
 

主要的:

 应用插件:com.android.library

依赖{
    编译文件树(导演:库,包括:的* .jar)
}

安卓{
    compileSdkVersion 16
    buildToolsVersion '22 .0.1

    sourceSets {
        主要 {
            manifest.srcFile的Andr​​oidManifest.xml
            java.srcDirs = ['src'中]
            resources.srcDirs = ['src'中]
            aidl.srcDirs = ['src'中]
            renderscript.srcDirs = ['src'中]
            res.srcDirs = ['水库']
            assets.srcDirs = ['资产']
        }

        //移动测试,测试/ java中,测试/ RES等...
        instrumentTest.setRoot(测试)

        //将建设各类建设类型/<类型>
        //例如,构建类型/调试/ java中,构建类型/调试/ AndroidManifest.xml中,...
        //这会将他们从src下他们默认位置/<类型> / ...这将
        //与SRC /冲突正在使用的主要来源集中。
        //添加新的构建类型或产品的口味应附有
        //通过类似定制。
        debug.setRoot(集结类型/调试)
        release.setRoot(集结类型/释放)
    }
}
 

我在想,有些配置丢失(也许),真正是我超级失落。

我在iOS程序员,这是Android中,该项目已完成由另一个人我的第一个步骤,现在我应该继续下去,所以我们可以说我在与Android Studio和好打它看着我失去;-P

感谢您的帮助。

更新:

我在日志中发现这一点:

解决方案

来自Android的播放服务7.3.0的问题。

尝试:

 相关性{
    编译com.google.android.gms:播放服务:87年6月5日
}
 

或启用multiDex:

  defaultConfig {
    的minSdkVersion 14
    targetSdkVersion 19
    版本code 1
    VERSIONNAME versionNameVar
    multiDexEnabled真
}
 

(multiDex解决方案编译,但可能会崩溃,在应用程序启动)

I have tried to migrate an Eclipse Android project to Android Studio, I have tried both ways, open directly from Android Studio and migrating to Gradle in Eclipse first and then open it in Android Studio.

Then I have tried to remove the Google Play library folder and added it in my Gradle file, and then the project do this:

  • Make Project OK
  • Clean Project OK
  • Rebuild Project OK
  • Gradle sync and download a lot of DLL OK
  • Play or Debug KO and gives me this errors:

OR

OR

I have started with JDK 1.6, then updated to 1.7 and then to 1.8 to see if that was the problem.

If I don't delete the Google Play Dervices folders the project works just fine.

I'm using a MAC if that is important.

And if that matter to solve this problem, I'm having this other problem in my project posted in stack overflow.

This is how it looks my project structure:

And this are the build.grade files of all the projects

Main warper project (guestperience 1.0.1 Moncloa De San Lazaro):

// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
    repositories {
        jcenter()
    }
    dependencies {
        classpath 'com.android.tools.build:gradle:1.2.0'
    }
}

goSmart.guestperience.MoncloaDeSanLazaro (this is where I code):

apply plugin: 'com.android.application'

dependencies {
    compile fileTree(dir: 'libs', include: '*.jar')
    compile project(':librarySmartHotel')
    compile 'com.google.android.gms:play-services:7.3.0'
}

android {
    compileSdkVersion 16
    buildToolsVersion "22.0.1"

    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')
    }
}

librarySmartHotel:

apply plugin: 'com.android.library'

dependencies {
    compile fileTree(dir: 'libs', include: '*.jar')
    compile project(':main')
}

android {
    compileSdkVersion 16
    buildToolsVersion '22.0.1'

    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')
    }
}

main:

apply plugin: 'com.android.library'

dependencies {
    compile fileTree(dir: 'libs', include: '*.jar')
}

android {
    compileSdkVersion 16
    buildToolsVersion '22.0.1'

    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')
    }
}

I'm thinking that some configuration is missing (maybe), the true is that I'm super lost.

I'm an iOS programmer and this are my first steps in Android, the project has been done by another guy, and now I'm supposed to continue, so let's say I'm having a good fight with Android Studio and it looks that I'm loosing ;-P

Thanks for the help.

UPDATE:

I have found this in the log:

解决方案

The problem come from Android Play Services 7.3.0.

Try :

dependencies {
    compile 'com.google.android.gms:play-services:6.5.87'
}

or enable multiDex:

defaultConfig {
    minSdkVersion 14
    targetSdkVersion 19
    versionCode 1
    versionName versionNameVar
    multiDexEnabled true
}

(multiDex solution compile, but might crash at app launch)

这篇关于异常试图从Eclipse的运行Android应用程序到Android工作室的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-24 17:08