Showing posts with label AS. Show all posts
Showing posts with label AS. Show all posts

Thursday, April 7, 2016

release and debug 成了鸡肋

当 release and debug 成了鸡肋的时候,我也是醉了!


以前,我认为,这个很有用的东西,现在成了鸡肋了,
因为,公司需要多个版本协同开发,说白就是 外包了。嘿嘿,release debug 只适用于一个产品,不适用于多个产品的问题,如何解决这个问题呢? 之前的博客有提及到,自己搜一下。


今天,突然发现  如果,你在某一个 favers 上配置了 string.xml 或者固定的类,就没有必要再 debug and release 上面重新定义了!


Wednesday, April 6, 2016

GeekHades 如何使用Android Studio 运行不同的版本


很多的时候,我们可能有收费版和普通版,这个时候我们在写的时候,一般我们在使用Android Studio的时候,一般都只是用 debug model. But today,    I want tell you  a new way to run different version use Android studio.

module  build.gradle  file :
like this:
productFlavors {

    anzhi {
        manifestPlaceholders = [umengHolder: "anzhi"]
    }

    mse {
        applicationId project.MSE_APP_PACKAGE_NAME        manifestPlaceholders = [umengHolder: "anzhi"]
    }

    xiaojialianhang {
        applicationId project.XJLH_APP_PACKAGE_NAME        manifestPlaceholders = [umengHolder: "anzhi"]
    }

    x86 {
        ndk {
            abiFilter "x86"        }
    }

    arm {
        ndk {
            abiFilter "armeabi-v7a"        }
    }

}

这里我用了多渠道打包,所以这里的UmengHolder 只是一个替换值。

2  最重要的一步,我之前从来没有用过的 一个View in the Android Studio:    Build Variants
It is in the left bottom in the windows.

you click it you can see this:
Add caption
you can see the app item. you can choose the you want run version:
like this:




Now, You just run  Ok. You will get new apt is you choise one!


Thanks TO :


http://stackoverflow.com/questions/17656826/what-product-flavor-does-android-studio-build-by-default-in-build-gradle



Monday, February 22, 2016

WARN - inspections.IntellijLintClient - No projects found for []

Today I use Android studio . I meet this question:

WARN - inspections.IntellijLintClient - No projects found for [] 




I see many the same question, But I can not find the way to resolve the question.  So I use  click File ---> invalidate caches and restart .  And close Charles, I wait  long time. 

In a world ,I don't how to resolve  the question?

when i restart Computer and Android studio!

It is Ok !

Tuesday, February 16, 2016

Android studio 代码文件目录在顶部 不显示在 左侧?

   当你导入项目的时候,因为项目没有被Gradle 格式化!导致 目录显示在顶部,你需要做的就是,退出当前的AS,然后重新导入项目,才可以使用!

  很多时候,无法发现问题,真的是找不到自己的目的地!

Sunday, January 24, 2016

Android studio 2.0 preview 7 的坑

今天遇到几个问题,

1  Gradle sync failed: Another refresh project task is currently running for the project:  /Users/Hades/Work/MSEGit/mse/MSERentAgent
         Consult IDE log for more details (Help | Show Log)



2  INFO - ntellij.util.proxy.CommonProxy - <html>You have JVM property "https.proxyHost" set to "127.0.0.1".<br>This may lead to incorrect behaviour. Proxy should be set in Settings | HTTP Proxy<br>This JVM property is old and its usage is not recommended by Oracle.<br>(Note: It could have been assigned by some code dynamically.)





 I can't resolve this question. If you just for fun, you can use the new android studio tool.
if  you work for a group, I recomand you use the stable version.

Friday, January 22, 2016

如何给Android studio 设置代理?

用了这么久,今天才知道如何给Android studio 设置代理。我他妈的也是醉了,感觉还不错的奥!哈哈

为什么要用代理

如今android studio越来越流行,很多的android程序猿都开始转入anroid studio的大本营。但是GFW的封锁成为很多人的困扰,eg:无法更新sdk,无法使用如下方式添加类库:
compile 'com.android.support:support-v4:23.0.0'
compile 'com.android.support:appcompat-v7:23.0.0'
compile 'com.android.support:design:23.0.0'
翻墙软件有很多,我使用的是shadowsocks,选择Shadowsocks.com 普通版 ¥99.00CNY 年付。对于搞android开发的,我觉得这个很有必要而且价格也不是很贵。

如何设置代理

下面,开始讲如何设置android studio的shadowsocks代理:
File-->Settings... 按照下图配置
  1. 设置自动代理
    This will attempt to user your system settings and is useful if your system uses a proxy autoconfiguratioin file(.pac) 
    • 勾选 Auto-detect proxy settings后android studio会自动走你操作系统设置的代理。
    • 勾选Automatic proxy configuration URL并设置本地pac文件

    Image 2.png
  2. 设置手动代理
    由于ShadowSocks是socks方式所以需要按照下图的方式配置

    settings
    点击ok后会在项目根目录的gradle.properties文件中生成如下代码:
    systemProp.http.proxyHost=127.0.0.1
    systemProp.http.proxyPort=1080
    到此,就配置完毕了。



http://www.jianshu.com/p/5fa894881667

Tuesday, December 1, 2015

java.lang.java.lang.RuntimeException: Unable to start actjava.lang.IllegalArgumentException: wrong number of arguments; expected 0, got 1

Android studio 2.0 新的坑! 

今天,突然收到客户更新包的时候,不能运行的Bug! 我很是蛋疼,与开始查是什么问题?

java.lang.java.lang.RuntimeException: Unable to start actjava.lang.IllegalArgumentException: wrong number of arguments; expected 0, got 1

这个问题,是反射的问题,参数不正确!

我的 v1.9.3  的包是 用 Android studio 2.0 打的包! 但是V1.9.4 心的版本,发现在2.0 上有问题,所以就使用了稳定版1.4.0 版本。

于是,我怀疑是Android studio 2.0 搞鬼。我也是醉了!  我用AS 1.4.0 打了V1.9.5 版本,覆盖V1.9.4 的时候没有问题,但是覆盖V1.9.3 还是会出错!


下面是详细的error info:
java.lang.java.lang.RuntimeException: Unable to start activity ComponentInfo{c.ui.activity.WelcomeActivity}: java.lang.IllegalArgumentException: wrong number of arguments; expected 0, got 1
12-01 16:59:57.940 29200-29200/? E/AndroidRuntime:     at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2201)
12-01 16:59:57.940 29200-29200/? E/AndroidRuntime:     at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2250)
12-01 16:59:57.940 29200-29200/? E/AndroidRuntime:     at android.app.ActivityThread.access$800(ActivityThread.java:141)
12-01 16:59:57.940 29200-29200/? E/AndroidRuntime:     at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1213)
12-01 16:59:57.940 29200-29200/? E/AndroidRuntime:     at android.os.Handler.dispatchMessage(Handler.java:102)
12-01 16:59:57.940 29200-29200/? E/AndroidRuntime:     at android.os.Looper.loop(Looper.java:136)
12-01 16:59:57.940 29200-29200/? E/AndroidRuntime:     at android.app.ActivityThread.main(ActivityThread.java:5065)
12-01 16:59:57.940 29200-29200/? E/AndroidRuntime:     at java.lang.reflect.Method.invokeNative(Native Method)
12-01 16:59:57.940 29200-29200/? E/AndroidRuntime:     at java.lang.reflect.Method.invoke(Method.java:515)
12-01 16:59:57.940 29200-29200/? E/AndroidRuntime:     at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:793)
12-01 16:59:57.940 29200-29200/? E/AndroidRuntime:     at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:609)
12-01 16:59:57.940 29200-29200/? E/AndroidRuntime:     at dalvik.system.NativeStart.main(Native Method)
12-01 16:59:57.940 29200-29200/? E/AndroidRuntime:  Caused by: java.lang.IllegalArgumentException: wrong number of arguments; expected 0, got 1
12-01 16:59:57.940 29200-29200/? E/AndroidRuntime:     at java.lang.reflect.Method.invokeNative(Native Method)
12-01 16:59:57.940 29200-29200/? E/AndroidRuntime:     at java.lang.reflect.Method.invoke(Method.java:515)
12-01 16:59:57.940 29200-29200/? E/AndroidRuntime:     at com.google.dexmaker.stock.ProxyBuilder.callSuper(Unknown Source)
12-01 16:59:57.940 29200-29200/? E/AndroidRuntime:     at com.eallcn.rentagent.proxy.callback.AsyncMethodAtomInterceptor.intercept(Unknown Source)
12-01 16:59:57.940 29200-29200/? E/AndroidRuntime:     at com.eallcn.rentagent.proxy.Enhancer.invoke(Unknown Source)
12-01 16:59:57.940 29200-29200/? E/AndroidRuntime:     at SingleControl_Proxy.setModel(SingleControl_Proxy.generated)
12-01 16:59:57.940 29200-29200/? E/AndroidRuntime:     at com.eallcn.rentagent.proxyhelper.BaseAsyncHelper.a(Unknown Source)
12-01 16:59:57.940 29200-29200/? E/AndroidRuntime:     at com.eallcn.rentagent.proxyhelper.BaseAsyncHelper.a(Unknown Source)
12-01 16:59:57.940 29200-29200/? E/AndroidRuntime:     at com.eallcn.rentagent.proxyhelper.BaseAsyncHelper.onCreate(Unknown Source)
12-01 16:59:57.940 29200-29200/? E/AndroidRuntime:     at com.eallcn.rentagent.proxyhelper.ActivityHelper.onCreate(Unknown Source)
12-01 16:59:57.940 29200-29200/? E/AndroidRuntime:     at com.eallcn.rentagent.ui.activity.BaseActivity.onCreate(Unknown Source)
12-01 16:59:57.940 29200-29200/? E/AndroidRuntime:     at com.eallcn.rentagent.ui.activity.WelcomeActivity.onCreate(Unknown Source)
12-01 16:59:57.940 29200-29200/? E/AndroidRuntime:     at android.app.Activity.performCreate(Activity.java:5249)
12-01 16:59:57.940 29200-29200/? E/AndroidRuntime:     at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1087)
12-01 16:59:57.940 29200-29200/? E/AndroidRuntime:     at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2165)
12-01 16:59:57.940 29200-29200/? E/AndroidRuntime:     at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2250) 
12-01 16:59:57.940 29200-29200/? E/AndroidRuntime:     at android.app.ActivityThread.access$800(ActivityThread.java:141) 
12-01 16:59:57.940 29200-29200/? E/AndroidRuntime:     at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1213) 
12-01 16:59:57.940 29200-29200/? E/AndroidRuntime:     at android.os.Handler.dispatchMessage(Handler.java:102) 
12-01 16:59:57.940 29200-29200/? E/AndroidRuntime:     at android.os.Looper.loop(Looper.java:136) 
12-01 16:59:57.940 29200-29200/? E/AndroidRuntime:     at android.app.ActivityThread.main(ActivityThread.java:5065) 
12-01 16:59:57.940 29200-29200/? E/AndroidRuntime:     at java.lang.reflect.Method.invokeNative(Native Method) 
12-01 16:59:57.940 29200-29200/? E/AndroidRuntime:     at java.lang.reflect.Method.invoke(Method.java:515) 
12-01 16:59:57.940 29200-29200/? E/AndroidRuntime:     at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:793) 
12-01 16:59:57.940 29200-29200/? E/AndroidRuntime:     at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:609) 
12-01 16:59:57.940 29200-29200/? E/AndroidRuntime:     at dalvik.system.NativeStart.main(Native Method) 

Friday, November 27, 2015

Execution failed for task ':app:transformResourcesWithMergeJavaResForDevDebugAndroidTest'. > com.android.build.api.transform.TransformException: com.android.builder.packaging.DuplicateFileException: Duplicate files copied in APK META-INF/maven/


I use the Android studio 2.0 vesion to run porgram:

But have the question:


I search for long time, But have the right answer
you can get answer in the link:
https://code.google.com/p/android/issues/detail?id=192835

resolve way:
packagingOptions {
    
    exclude 'META-INF/maven/com.belerweb/pinyin4j/pom.properties'    exclude 'META-INF/maven/com.belerweb/pinyin4j/pom.xml'}

I think, Because the libs infomation. I find this quesiton by myself. Because I see this:

So I know. why take this question. In the Android sutdio 2.0 version. The gradle build the program, it will scan the libs, I know this. But know. it will by the pom.properties info will ckeckout pingyin4j.jar twice in the mevanCenter. So you must in the gradle
config this code: you must know in where!

packagingOptions {
    
    exclude 'META-INF/maven/com.belerweb/pinyin4j/pom.properties'    exclude 'META-INF/maven/com.belerweb/pinyin4j/pom.xml'}


You can use gradle build this question. But when I run the program. I meet the new question:

http://stackoverflow.com/questions/33967703/unable-to-instantiate-application-com-android-tools-fd-runtime-bootstrapapplicat

Now I don't know how to reslove the new question!

But I choise a bad way to reslove the question. 
I use the stable verion android studio 1.4.0

So it is resolve! So I know The question is about the Android studio 2.0 versoion! It is not stabley!









refence link:

1  https://code.google.com/p/android/issues/detail?can=2&start=0&num=100&q=&colspec=ID%20Type%20Status%20Owner%20Summary%20Stars&groupby=&sort=&id=192835


2  https://code.google.com/p/android/issues/detail?can=2&start=0&num=100&q=&colspec=ID%20Type%20Status%20Owner%20Summary%20Stars&groupby=&sort=&id=192835

3  http://stackoverflow.com/questions/25015539/gradle-android-optimize-packagingoptions


4  http://stackoverflow.com/questions/33967703/unable-to-instantiate-application-com-android-tools-fd-runtime-bootstrapapplicat




Tuesday, November 24, 2015

Android Studio 发布了 2.0 版本

作为一个屌丝级别的程序员,我需要做的就是及时的更新自己的技术和自己的工具。使用最新的APP, 和开发工具? 为什么会更新呢?是因为,有新的特性和不同功能的地方是对以前的优化和增加新功能,才会有新的版本。要不然为射门呢不适用老的版本?

第一: gradle 加载
Android  studio 2.0 在gradle 插件方面做了优化,当你运行一次之后,当你修改了代码之后你的运行速度要比以前快很多,这点亦可以看一下: 比之前快了一倍,之前的大概花费一分钟左右(修改了代码)。
设置快速调试的方法 勾选第一个item:

这是因为,好像Gradle 的插件加载机制做了优化,只在第一次的时候加载,之后就重用第一次加载的第三方的工具!


第二个: 运行暂停
还有在运行的时候,可以断掉运行。 我们可以新添加的icon 


第三个   查看你的任务
不论你是用Git 还是SVN ,  Shit + Alt + T  你可以查看到 自己自己提交的任务。 还有注释, 这就是 你调代码的时候编写的注释!很方便的