首页 文章 精选 留言 我的

精选列表

搜索[编译],共10000篇文章
优秀的个人博客,低调大师

iOS:Xcode的beta下编译低版本项目时,出现的Link错误( "_fwrite$UNIX2003", referenced from...

开发的项目多了,对于一个i386的错误,处理起来应该是得心应手的,可是仔细看来,跟之前遇到i386的错误还不大一样,直接搜i386是搜不到该问题解决的方法,你要是搜“Undefined symbols for architecture i386”会搜出一些答案,但也不是很多,并且能不能解决当前遇到的问题,还得自己试过后才知道行还是不行。这里我就给大家说一下我当时搜到的一些解决方法: 1、缺少类库,自己项目缺不缺少类库自己还是知道的,看上面的错误也像是缺少类库,所以这个答案直接抛 弃掉 2、这个就需要自己动手操作一下,这里我就简单说下步骤,截图嘛,最后也没有帮我解决问题,所以复述下步骤,有空的时候可以试下:点击Xcode左栏项目工程:Target—>Build Settings—>Apple LLVM 6.0 - language - c++到此,修改c++ Standard Library 属性为 libstdc++(GNU C++ standard library) 以上两中方法都没能真正的解决问题,难道这个问题就没有解决办法了,别急,下面就是解决问题的方法了 出现的错误截图: 解决办法: 首先在AppDelegate.h文件中添加如下代码: #ifdef DEBUG FILE *fopen$UNIX2003(const char *filename, const char *mode); size_t fwrite$UNIX2003(const void *ptr, size_t size, size_t nitems, FILE *stream); #endif 再在AppDelegate.m文件中添加如下代码: #ifdef DEBUG FILE *fopen$UNIX2003(const char *filename, const char *mode) { return fopen(filename, mode); } size_t fwrite$UNIX2003(const void *ptr, size_t size, size_t nitems, FILE *stream) { return fwrite(ptr, size, nitems, stream); } #endif 或者: 首先在AppDelegate.h文件中添加如下代码: #if defined (__unix) || (CC_TARGET_PLATFORM == CC_PLATFORM_IOS) #ifndef __ENABLE_COMPATIBILITY_WITH_UNIX_2003__ #define __ENABLE_COMPATIBILITY_WITH_UNIX_2003__ FILE *fopen$UNIX2003(const char *filename, const char *mode); size_t fwrite$UNIX2003(const void *ptr, size_t size, size_t nitems, FILE *stream); #endif #endif 再在AppDelegate.m文件中添加如下代码: #if defined (__unix) || (CC_TARGET_PLATFORM == CC_PLATFORM_IOS) #ifndef __ENABLE_COMPATIBILITY_WITH_UNIX_2003__ #define __ENABLE_COMPATIBILITY_WITH_UNIX_2003__ FILE *fopen$UNIX2003(const char *filename, const char *mode) { return fopen(filename, mode); } size_t fwrite$UNIX2003(const void *ptr, size_t size, size_t nitems, FILE *stream) { return fwrite(ptr, size, nitems, stream); } #endif #endif 在指定的类中添加以上代码,问题就解决了。 这可能是Xcode的一个bug,升级到正式版,可能就不存在这个问题。 参考:http://blog.sina.com.cn/s/blog_b2b0ab4b0102v8k7.html 程序猿神奇的手,每时每刻,这双手都在改变着世界的交互方式! 本文转自当天真遇到现实博客园博客,原文链接:http://www.cnblogs.com/XYQ-208910/p/5613904.html ,如需转载请自行联系原作者

优秀的个人博客,低调大师

【Andrioid】在Gradle编译时生成一个不同的版本号,动态设置应用程序标题,应用程序图标,更换常数

写项目的时候常常会遇到下面的情况: 1.须要生成測试版本号和正式版本号的apk 2.測试版本号和正式版本号的URL是不一样的 3.測试版本号和正式版本号的包名须要不一致,这样才干安装到同一部手机上面。 4.不同apk须要应用名不同,图标不同,某些常量不同.... 假设你有以上的需求。看这篇文章就对了 When developing an app, you usually have many slightly different versions of this app. The most common example is probably the backend you want to use:productionorstaging. 当我们做开发的时候。常常会须要生成多个版本号的app。 最常见的就是測试版和正式版。 You usually define the base URLs with the other constants of the app. Switching from one environment to the other is done by (un)commenting the right lines: 我们经常须要在应用中定义一些常量,当应用正式公布的时候,经常是凝视掉測试用的部分,放开正式的部分,就像以下一样: public static String BASE_URL = "http://staging.tamere.be" //public static String BASE_URL = "http://production.tamere.be" The process is manual, boring and error prone but hey, changing one line is not that bad, is it? Then you add more and more features that depends on the environment. You maybe want a different icon and then different input validation rules and then ... That's where your build tool can help. Let's see how we can automate the process of generating different APKs for different environment with Gradle. 上面的步骤是烦躁。无味的,改动一个地方还好。代码写多了以后正过来整过去就egg_pain了,这个时候我们Gragle就闪亮登场了 Build variants Gradle has the concepts ofBuild TypesandBuild Flavors. When combining the two, you get aBuild Variant. There two default build types:releaseanddebug. We won't change them in our example but we will create two new flavors:productionandstaging. Gradle默认有release和debug两个版本号。 我们这里添加了production和staging.两两组合就是以下4个版本号了。 As a result, we'll have four different variants: ProductionDebug ProductionRelease StagingDebug StagingRelease Sample project 演示样例项目 The project is pretty simple but shows how you can define for each build variant: an app name an icon constants (in our case aBASE_URLvariable) You can download the project onGithub. Here are two screenshots of the generated apps. Nothing really fancy: 演示样例项目非常easy。在不同的版本号中我们须要改动项目名称。项目图标,一些常量:url...,项目能够从Github下载,效果图例如以下: build.gradle file buildscript { repositories { mavenCentral() } dependencies { classpath 'com.android.tools.build:gradle:0.5.+' } } apply plugin: 'android' repositories { mavenCentral() } android { compileSdkVersion 18 buildToolsVersion "18.0.1" defaultConfig { minSdkVersion 15 targetSdkVersion 18 } productFlavors { production { packageName "be.tamere.gradlebuildtypesexample" } staging { packageName "be.tamere.gradlebuildtypesexample.staging" } } } dependencies { compile 'com.android.support:appcompat-v7:18.0.0' } The definition of the flavors is super simple, all the magic will happen in their folders. 改动非常easy:核心配置是productFlavors,同一时候须要注意production和staging。它们须要与后面的文件夹结构名字一致 File structure 改动后的文件结构 In thesrcfolder, we've created two directories whose names must match the flavors. We will define all the flavor-specific values. Only specific values are necessary. 改动也比較简单,在src以下(main同级的文件夹)新建和上面productFlavors中配置production和staging同样的文件夹,分别放入相应的Constants.java。这两个文件夹的属性和功能与系统默认创建的main是一样的。 总结一下就是: 1.production和staging两个文件夹,相应着各存放一份Constants.java 2.对于应用图标和应用名字信息配置在res文件夹以下的。这个地方针对staging又一次配置了一份ic_launcher.png和string.xml。production没配置的话就是用默认main以下的res。 这个比較easy理解哈。 The staging version defines new icons while both flavors defines aConstants.java. The app name is defined in thestring.xmlfiles. ├── main │ ├── AndroidManifest.xml │ ├── ic_launcher-web.png │ ├── java │ │ └── be │ │ └── tamere │ │ └── gradlebuildtypesexample │ │ └── MainActivity.java │ └── res │ ├── drawable-hdpi │ │ └── ic_launcher.png │ ├── drawable-mdpi │ │ └── ic_launcher.png │ ├── drawable-xhdpi │ │ └── ic_launcher.png │ ├── drawable-xxhdpi │ │ └── ic_launcher.png │ ├── layout │ │ └── activity_main.xml │ ├── menu │ │ └── main.xml │ ├── values │ │ ├── dimens.xml │ │ ├── strings.xml │ │ └── styles.xml │ ├── values-v11 │ │ └── styles.xml │ └── values-v14 │ └── styles.xml ├── production │ └── java │ └── be │ └── tamere │ └── gradlebuildtypesexample │ └── Constants.java └── staging ├── java │ └── be │ └── tamere │ └── gradlebuildtypesexample │ └── Constants.java └── res ├── drawable-hdpi │ └── ic_launcher.png ├── drawable-mdpi │ └── ic_launcher.png ├── drawable-xhdpi │ └── ic_launcher.png ├── drawable-xxhdpi │ └── ic_launcher.png └── values └── string.xml Android Studio You can switch between the two flavors in theBuild variantstab of the IDE. Android Studio has some trouble identifying the resources for a non-active flavors. We are using theproductionflavor, Studio does not understand that thestagingfolder contains source code. Don't worry, it's normal, it will catch up when you switch to the staging variant. Launch the app with the different flavors to see the result. The app drawer shows the two icons: References http://tools.android.com/tech-docs/new-build-system/user-guide#TOC-Product-flavors Xav's answer on thisStack overflow topicis particularly helpful. 原文地址: http://tulipemoutarde.be/2013/10/06/gradle-build-variants-for-your-android-project.html 本文转自mfrbuaa博客园博客,原文链接:http://www.cnblogs.com/mfrbuaa/p/4734552.html,如需转载请自行联系原作者

资源下载

更多资源
优质分享App

优质分享App

近一个月的开发和优化,本站点的第一个app全新上线。该app采用极致压缩,本体才4.36MB。系统里面做了大量数据访问、缓存优化。方便用户在手机上查看文章。后续会推出HarmonyOS的适配版本。

腾讯云软件源

腾讯云软件源

为解决软件依赖安装时官方源访问速度慢的问题,腾讯云为一些软件搭建了缓存服务。您可以通过使用腾讯云软件源站来提升依赖包的安装速度。为了方便用户自由搭建服务架构,目前腾讯云软件源站支持公网访问和内网访问。

Nacos

Nacos

Nacos /nɑ:kəʊs/ 是 Dynamic Naming and Configuration Service 的首字母简称,一个易于构建 AI Agent 应用的动态服务发现、配置管理和AI智能体管理平台。Nacos 致力于帮助您发现、配置和管理微服务及AI智能体应用。Nacos 提供了一组简单易用的特性集,帮助您快速实现动态服务发现、服务配置、服务元数据、流量管理。Nacos 帮助您更敏捷和容易地构建、交付和管理微服务平台。

Spring

Spring

Spring框架(Spring Framework)是由Rod Johnson于2002年提出的开源Java企业级应用框架,旨在通过使用JavaBean替代传统EJB实现方式降低企业级编程开发的复杂性。该框架基于简单性、可测试性和松耦合性设计理念,提供核心容器、应用上下文、数据访问集成等模块,支持整合Hibernate、Struts等第三方框架,其适用范围不仅限于服务器端开发,绝大多数Java应用均可从中受益。

用户登录
用户注册
修改密码
忘记密码