2018. 12. 30. 12:11 안드로이드

 productFlavors 사용법



app gradle 설정 

빨간 부분이 추가 된 부분입니다.

android {
compileSdkVersion 27
defaultConfig {
applicationId "home.com.productflavor"
minSdkVersion 17
targetSdkVersion 27
flavorDimensions "default"
versionCode 1
versionName "1.0"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}

productFlavors{
dev {
applicationId "home.com.productflavor.dev"

}
real {
applicationId "home.com.productflavor.real"

}
}

}

dependencies {

..........
}


프로젝트네비게이션 구조



저기 dev는 java가 파랑색인데 왜 real java는 그렇지 않은가 궁금할텐데 

그건 build variants 를 real로 설정하나 dev로 설정하나에 따라서 달라진다




소스는 단순하다 

MainActivity.java

public class MainActivity extends AppCompatActivity {

@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
Toast.makeText(this,Cons.data,Toast.LENGTH_SHORT).show();
TextView tv = findViewById(R.id.location);
tv.setText(R.string.location);
}
}

real Cons.java

public class Cons {
public static final String data="222";
}

real strings.xml

<?xml version="1.0" encoding="utf-8"?>
<resources>
<string name="location">real</string>
</resources>

dev Cons.java 

public class Cons {
public static final String data="111";
}

dev strings.xml

<?xml version="1.0" encoding="utf-8"?>
<resources>
<string name="location">dev</string>
</resources>


이렇게 두면 build Variant 가 real로 세팅되면 real이 표시되고 dev로 세팅되면 dev로 텍스트 뷰에 표시가 된다 .


프로젝트 

flavrotest.zip


posted by 욱이다
2018. 12. 12. 18:41 아이폰

담당자가 퇴사한 프로젝트를 ad hoc 으로 배포할려고 컴파일을 하는데 에러가 났다.

어떻게 해서 컴파일 완료 하고 배포가 되었따 어느 순서에서 수정된건지 몰라 작업 내용을 적어 둔다.

마지막에 한 작업이 결정적이었다.


에러 내용 - Doesn't match entitlements file value for application-identifier


에러 내용 - Profile doesn't match the entitlements file's value for the application-identifier entitlement

에러 내용  - Automatic signing is unable to resolve an issue with the "***.app" target's entitlements.

Switch to manual signing and resolve the issue by downloading a matching provisioning profile from the developer website. Alternatively, to continue using automatic signing, remove these entitlements from your entitlements file and their associated functionality from your code. Then rebuild your archive and try again.



build setting 쪽을 확인해서

bundle identifier 에 com.domain.appname 으로 변경을 시도했다 

그래도 안된다 


도메인이 들어가야될 부분에 컴퓨터 이름이 들어간 부분들을 다수정한다 .

Sons.*** 이런 것들을 com.domain.appanme.*** 으로 수정해도 안된다 


https://developer.apple.com/account/ios/certificate/ 접속해 안쓰는 프로파일들을 다지고 

새로 만든다 (지운다고 서비스 안되는건 아니니깐)


그리고 마지막으로 폴더 이동을 한다 


~/Library/MobileDevice/Provisioning Profiles


싹다 지운다 그리고 다시하면 adhoc 컴파일이 완료된다 


제발 도움이 되길 바란다.




posted by 욱이다
prev 1 next