简体   繁体   English

Android Studio参考库

[英]Android Studio reference Library

Hey guys I really got a problem I can't solve. 大家好,我真的有一个无法解决的问题。

I'm developing an Android application which needs a library I wrote for myself (model.jar). 我正在开发一个Android应用程序,它需要一个我为自己编写的库(model.jar)。 I added it to Android Studio and everything was fine. 我将其添加到Android Studio,一切都很好。 On some point it just didn't work anymore so I did everything I could do: 在某种程度上,它不再起作用了,所以我做了我能做的一切:

  • removed the not working library from my project 从我的项目中删除了不起作用的库
  • put the library to the projects /libs directory 将库放入项目/ libs目录
  • added the libray via Project Structure -> File dependency -> model.jar 通过项目结构->文件依赖-> model.jar添加了libray
  • added the jar to the projects .gradle file to compile 将jar添加到项目.gradle文件中进行编译
  • Rebuild Project 重建项目
  • Invalidate Caches and restart 使缓存无效并重新启动
  • deleted the projects .iml file and .idea folder and reimported the application 删除了项目.iml文件和.idea文件夹,然后重新导入了应用程序
  • executed gradlew clean and gradlew assemble from command line 从命令行执行gradlew cleangradlew assemble
  • edit: I did also a Sync Project with Gradle Files 编辑:我也做了与Gradle文件的同步项目

However none of these worked. 但是这些都不起作用。 It still cannot resolve the objects from the jar and I'm just stuck. 它仍然无法解析jar中的对象,我被卡住了。

Since I am not allowed to post images directly I uploaded it into my dropbox 由于不允许直接发布图片,因此我将其上传到我的保管箱

Note that I cannot expand the model.jar as the other libraries that do work. 请注意,我无法像其他可以使用的库一样扩展model.jar。

The build.gradle: build.gradle:

apply plugin: 'com.android.application'

android {
   compileSdkVersion 21
   buildToolsVersion '20.0.0'

   defaultConfig {
        applicationId "de.rcsrcs.osiris"
        minSdkVersion 14
        targetSdkVersion 21
        versionCode 1
        versionName "1.0"
    }
    buildTypes {
        release {
            runProguard false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
    }
}

dependencies {
    compile fileTree(dir: 'libs', include: ['*.jar'])
    compile files('libs/mina-core-2.0.9.jar')
    compile files('libs/slf4j-api-1.7.7.jar')
    compile files('libs/slf4j-log4j12-1.7.7.jar')
    compile files('libs/slf4j-jdk14-1.7.7.jar')
    compile files('libs/model.jar')
    compile 'com.google.android.gms:play-services:6.1.71'
    compile 'com.android.support:appcompat-v7:21.0.0'
    compile 'com.android.support:support-v4:21.0.0'
    compile 'com.android.support:recyclerview-v7:21.0.0'
}

As said before, the mina libraries work fine. 如前所述,mina库工作正常。

Thanks for your help! 谢谢你的帮助!

JAR files, being files, can get mangled accidentally from time to time. 作为文件的JAR文件有时会不小心被弄乱。 If your IDE sees the JAR (eg, it shows up in the list of dependencies in Android Studio), but it does not see contents of the JAR, check to make sure that it is a clean copy of the JAR. 如果您的IDE可以看到JAR(例如,它显示在Android Studio中的依赖项列表中),但是看不到JAR的内容 ,请检查以确保它是JAR的完整副本。 Ideally, the IDE would be a bit more "in your face" about a broken JAR file... 理想情况下,关于损坏的JAR文件,IDE会“更多地面向您” ...

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM